Category Archives: Coding

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

Error Message Video

Here is a video tutorial giving an overview of the error message problem.

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

Numbered Error Messages Do Not Work

As part of a series of posts about error messages, this post covers a very specific claim: a single error message picked from a list of error messages is a bad idea and produces poor error reporting.  We start with … Continue reading

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

Code Copy Guidelines

This post presents some guideline reduce duplicates in the code. Whenever you notice that you’re writing blocks of code that are substantially similar, try to make a routine (method) that embodies that code and call it from all the places. … Continue reading

Posted in Coding | Leave a comment

Variable Naming

Here are some coding guidelines about using meaningful names in the program. Most of them are taken from from Clean code book Choosing good names takes time but saves more than it takes.

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

Canonical Execution Error Example

If we are going to talk about error messages, we need to flesh out a typical computation scenario within which an error occurs.  I use this example in other places to talk about possible error messages.

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

Catching Generic Exception Classes

In Java you can have a try statement with multiple catch clauses.  In a method that handles exceptions, by for example wrapping and rethrowing, it is important to catch the root-most “Exception” class and this post explains why even though … Continue reading

Posted in Coding, Design, Poor Error Msg | 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

Handling Dates

In a globally distributed system, there are some key patterns for handling dates so that they work reliably, performantly, and are unlikely to be misused by developers.  Oddly, a number of new classes were added to Java which should be … Continue reading

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