Online. Offline. Bottom Line.™ (skip to the content)

Home | About | Jobs | Privacy Policy | Contact | Login or Register


Top Ten Errors In Programming Lists…

by

All programming languages have them.  It doesn’t matter if it is Java, C, C#, etc.  For every language there is somebody, somewhere, who has compiled a list of the top ten programming mistakes for that language (except PHP, where apparently 10 wasn’t enough).

As engineers, we read these lists, laugh about the times we made those mistakes ourselves, and sometimes cross post the lists on other popular development sites.  And that’s it.  After that we file them away and don’t think about them until the next list pops up in the tubes.  But it doesn’t have to end there.

There are ways that we can - and should use these lists to our advantage.  For instance, when new engineers start at your company, part of their training should include some type of exposure to the lists.  I was on my second job as an engineer before I learned the trick of swapping the order when using the String.equals() method.  For those that don’t know, someString.equals("Hello World"); has the potential to produce a null pointer exception if the someString variable had not been initialized.  But “Hello World”.equals(someString); will never throw a null pointer exception.  Teach new engineers these tricks early, and maybe some of these “common” programming mistakes will become less and less common.

I also use the lists during code inspections.  It is pretty easy to search through some code and look for most of them.  Doing a search for .equals(” does a pretty good job of finding spots where the above trick can be applied.  Again, the more we catch these mistakes today, the less we will see them in the future.  Unless you use PHP.  In that case you might be out of luck…

Found in • (1) CommentsPermalink http://www.sundog.net/index.php/sunblog/entry/top-ten-errors-in-programming-lists/
Like this post? Subscribe to our RSS feed. RSS icon

© 2008 Sundog, All Rights Reserved xhtml | css | 508 | What's This?