[quote user="rmr"]Maybe I'm dumb, what's the problem with the last one? The fact that he didn't use a temp variable?[/quote]
The check the coder used was to prevent a NullPointerException being thrown in the case that getValue() returned null (which btw it never can in this system).
The problem is that rather than using getValue()==null, they used getValue().equals(null), which will throw an exception in itself (if getValue() were null).
[quote user="rmr"]Judging by the fact that you've taken a Java 101 course, I'd recommend
that you not get too cocky, and don't be too quick to look for WTF's in
your coworker's code.[/quote]
Umm... I took this course only because I HAD to (ie. it was a core subject). I'd been using Java for at least 2 years prior, and coding for at least 10 years before that. I'd recommend that you don't turn a simple comment into a personal attack.
[quote user="rmr"]Trying to eschew all "superfluous" code will quickly make a project
unmaintainable and unreadable. For example, some programmers seem to
think vowels in their variable names are superfluous. I for one am
sick of reading variable names like "nwRgMCfg".[/quote]
I agree on this point, unfortunately I have to use our stupid naming convention or I get told off in code reviews. :(
[quote user="voyager"]Also, there ARE legitimate reasons to call super in constructors you know! A call to super is not a WTF in itself.[/quote]
Explain please? I'm talking about a call to super(). ie. the default constructor. If you need to call something other than that, then of course you should make a call to super(whatever). Explicitly calling the default constructor serves no purpose and just takes up extra space on my screen and extra disk space in our version control system (at my work, upgrading our server's <100gb hard drive is too expensive, apparently).
[quote user="merreborn"]What happened to coding standards? My first programming internship,
the coding standards were strictly enforced by a grumpy 40-something
who'd been programming since the late 70s. They included strict
80-char line wrapping (he coded exclusively in emacs), and indentation
rules.[/quote]
Fortunately I do a majority of the Java code reviews here, so I get to tell people off if they don't conform to standards (ie. my own) :) That and I personally configured the Eclipse code formatter on everyone's machine to be exactly the same, and people get a slap on the wrist from me if they check code in without first formatting it. Oh and 80 characters is so last century :) 23" widescreen ftw!
As for using the "this" keyword, I'll agree with the concensus here that it makes code clearer, but personally I've never really thought about it since Eclipse syntax highlights fields automatically. If it weren't for the fact that no-one at my work uses "this" unless they have to, I'd start using it more.
Oh and a comment to everyone here -- there's no such thing as an "instance variable" in Java, it's called a field. :)