Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.
« Oct 12

November 2012

Dec 12 »


The Factory pattern is an excellent way to solve a variety of programming problems using an object-oriented language. It’s a simple pattern, but for some developers, not quite simple enough. Den found this interface :
During his interview, Michael was asked what his coding pet peeves were. Things that, as a developer, really got under his skin.

Battleship Booleans

Barry’s first problem with the code was the use of magic numbers. If the application state variable held “127”, it then certain buttons would be enabled, but if it were “54”, then they should be disabled.