How to Code Like a Java Newbie

Last updated 1998 July 2 Roedy Green © 1998 Canadian Mind Products.

You might want to masquerade as someone young and inexperienced. Here is how to do it in your Java Code.

Boolean Redundancy

Newbies love to balloon out their code with redundancy. Here are some typical examples: An experienced programmer would handle that as: A newbie might try: It should be handled: A newbie might code: It should be handled:

String Redundancy

Newbies love to write things like: This should be written:

Too Big And Flexible a Hammer

Newbies discover exceptions and use them where simpler and more efficient constructs would work better. For example they might use them in place of a loop ending condition or even a boolean return flag.

Reflection dazzles, and newbies will use it where simple interfaces and delegate objects would suffice.

Sometimes an old-fashioned if or switch statement is easier to understand and maintain than a complicated nest of inherited classes. A newbie is intoxicated with the power of oo and wants to use it everywhere.

The more advanced newbie might discover the facade design pattern, and go overboard thinking that every class should implement every method with a wrapper.

HTML Checked!
Canadian Mind Products You can get an updated copy of this page from http://mindprod.com/newbie.html