Exception programming in Java

By Jeff Wu

In the past, Java programmers were actually encouraged to have deeply-nested if statements to handle business-logic errors. According to Robert C. Martin in his 1997 essay, “Java and C++ A critical comparison,” this was because during the early development of the Java language, Sun modeled Java’s Exception mechanism heavily against C++. Since then, Sun has come up with two different categorizations of Exceptions: checked and unchecked.
Read the rest of this entry »

An exploration of Immutable Types in Java

By Jeff Wu

In Java, many frustrating Exceptions, like a NullPointerException can be avoided with a judicious application of Immutable types. The most common mistake I see when developers are creating an immutable class is that it may *appear* to immutable, but it really isn’t (for several different reasons — some are easy to spot and some are not).
Read the rest of this entry »