Archive for October 13th, 2008
null checking in the extreme
October 13th, 2008 by Jeanne BoyarskyIn Java, we’re told to check for nulls to avoid unexpected null pointer exceptions. This can be taken too far though. Consider the following code: StringBuilder builder = new StringBuilder(): if ( builder != null ) { builder.append("data"); } When did builder have the opportunity to become null? By definition, a constructor creates an object. [...]
Categories: Development Process.
Tags: Java/J2EE, null
Comments: 17
