Category Archives: practice

Code Only What You Need

Only commit to code that which needs to committed to code.  Only write what needs to be written.  How hard can that be?  You might be surprised, but there are developers out there that are so enamored with the code … Continue reading

Posted in Coding, Design, practice | Tagged , , , , | Leave a comment

Don’t Use java.util.Optional

This is a class that attempts to replace null with different way to check for null.  While I can imagine some very rare cases that this could be useful, in general it is more complicated, slower, and takes more memory … Continue reading

Posted in Coding, Design, practice | Tagged , , | Leave a comment

Holographic Testing Technique

I write a lot of code, and I want there to be solid tests on that code.  Creating tests can be tedious, and that prevents many good tests from being written.  Also, because tests can be fragile, maintaining those tests … Continue reading

Posted in Coding, Example Code, practice | Tagged , , , , | Leave a comment

Factoring Functionality: Who Needs to Know?

There are many ways you can break the functionality of a program into blocks that are manageable: some right, some wrong.  This post promotes a simple principle.  The primary way should be around “who needs to know.”

Posted in Coding, Design, practice | Tagged , , , , , | Leave a comment

Don’t Erase Wrong Data

Data validation is a tricky area for usability.   On one hand you help the user by catching possible error early.  On the other hand, the validation check can not be perfect, so there are important errors to avoid.

Posted in Coding, practice | Tagged , , | Leave a comment

Safe API Upgrade

First consideration for any Application Programming Interface (API) is how it will evolve in the future.  This critical interface must stand the test of time, and should whenever possible be both upgrade and downgrade compatible. 

Posted in Coding, Design, practice | Tagged , , , , | Leave a comment

Eliminate Useless Comments

Be careful what you ask for.   I was reviewing some code that had absolutely no comments. I asked the developer to add some comment.   So, indeed they did, however the comments added no value to the code at all.   There … Continue reading

Posted in Coding, practice | Tagged , , , , | Leave a comment

The Magic of MemFile

In the Purple Utilities Library is a class called MemFile which you can efficiently stream into and out of. Learn to use it properly can increase the efficiency of your programs when reading and writing data.

Posted in Coding, Design, practice | Tagged , , , | Leave a comment

Return Null or Exception?

I am writing a getter function, and the requested object can not be found.  Do I return null?   Or do I throw an exception?  The answer is “it depends.”  Sometimes both options are needed, but how to decide?

Posted in Coding, Example Code, practice | Tagged , , , | Leave a comment

Write Bug Reports to Last

Encountered a bug report that cited a problem in “the new build.”   That is not good enough, because every week will bring a new “new build.”

Posted in practice | Tagged , , | Leave a comment