Category Archives: CodeCraft

On Creative Class Names

The subject of naming in code continues. In O’Reilly Network: Ill-monikered Variables and Creative Class Naming [May. 18, 2004], Tim O’Brien adds his comments to the topic of naming in programs. He picks up with Andy Lester’s earlier comments and goes a little further. O’Brien makes the suggestion that creative names are much better than… Read More »

The Law of Unintended Consequences

One of the fundamental laws of the universe could be called the Law of Unintended Consequences. This law is as universal as Murphy’s Law, but not as well recognized. To me, the gut-level understanding of this law is one of the things that shows the difference between a really good programmer and someone who just… Read More »

On Names, again

Isn’t it interesting how some ideas will surface in different unrelated places at close to the same time. O’Reilly Network: On the importance of names [Feb. 15, 2004] talks about how important the right name is for the success of a project. I think it may be more important not only for recognition but to… Read More »

More on Magic Constants

I’ve been thinking more on the issue of Magic Constants. Have you ever noticed that when some people first understand the idea of symbolic constants, they want to collect all of the constants they’ve defined together in one spot?

Magic Constants are bad

A truly bad code example in a book on Java Servlets got me thinking about the idea of Magic Constants. Of course, we are all aware of the problem of magic numbers or magic literals in code. That’s why we use symbolic constants instead to hide that implementation detail (and to simplify maintenance later). However,… Read More »

The Smite Class

In attempting to do Test Driven Development, we noticed that one of the problems with testing object validation code was the necessity to have broken objects to test with. This is particularly important in cases where the internals of an object may come from somewhere uncontrolled. For instance, objects that may be read from disk… Read More »