Tag Archives: programming

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

Good Error Messages Can Be Easy

Here is an error message I encountered one day.  It is frustrating, because obviously the code was checking something, but it is frustrating because you get no real clues what the problem really was, and a simple change would make … Continue reading

Posted in Coding, Example Code, Poor Error Msg | Tagged , , , , , | Leave a comment

What is wrong with this code?

It is code review time, and I offer a sample of Java code for you to critique.   Can you find the problems?

Posted in Coding | 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

Let Me Save Incomplete Files

This is a usability problem that I have run into a number of times.   A programmer writes a UI screen to receive a long list of inputs in order to create an object in system.  Save is enabled only when … Continue reading

Posted in Coding, Design, Uncategorized | 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

Variable Names & Key Values

Constructing JSON in Java can be a bother.  The most standard JSON library requires objects to be created, and then called to put the members on there.  So much easier in JavaScript, but it is not Java script.  Still, one … Continue reading

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

Keep Things the "Same"

This general design principle does not mean to never change anything, but to consciously create a paradigm where the same things have the same names and are accessed in the same way as much as possible.

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

Constants and Errors

Still reviewing that code base and finding more bad patterns for use of constants, this time for error messages.   This is another “don’t do this” post.

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