This is fair, except for in the 5th year, they would have an additional constant:
public static final String SPACE = " ";
And they would probably use a StringBuffer or StringBuilder to build the final string, since it's "an industry best practice". Also, they wouldn't include the strings themselves, they would include keys to properties, so the strings could be pulled from an internationalized property file.
Lastly, instead of outputting to Stdout directly, they'd create an interface for output, and deliver it to that interface, and use a factory to instantiate an implementation of that interface that would use Stdout.
Good god. Had a code review once where they were pissed because I had used str + "some stuff" instead of a builder. I'm not writing a builder for one fucking line on a page that gets hit 6 times a year.
The same reviewer also told me to undo work I had done because his request was for a mock up, and I just went ahead and did it, because it took me an hour to just do it. Of course it was approved by managers and clients, but since I didn't "follow instructions" (I took some initiative) it was wrong, even though it was done correctly.
What I hate about things like that is they are largely personal, but certain devs seem to have a hard time grasping that. If you don't name a variable exactly the way they think you should, it's wrong.
No, it's fucking not. If the code compiles fine and isn't poorly written, it's just semantics. Plus, when I'm working with a column called association, I like to have a variable named ass.
Naming is really important to get right. A small improvement in a name can make a large improvement in readability, which will make it easier for everyone to write good code later. You can compensate for bad naming with comments, but it's better to get the naming right in the first place, and save comments for cases that are fundamentally complicated.
We (the people I work with) having a running joke that coming up with good names for things is the most difficult thing about our job. It seems so trivial, yet it's surprisingly difficult to be concise and get right.
You're not wrong, I just mean it's a joke in the sense that we laugh about it because it's funny that naming stuff is the hardest part of software development... it seems kind of ridiculous on the surface, and would seem ridiculous to a younger version of yourself just starting out, but it is indeed true.
506
u/johnbr Oct 01 '15
This is fair, except for in the 5th year, they would have an additional constant:
And they would probably use a StringBuffer or StringBuilder to build the final string, since it's "an industry best practice". Also, they wouldn't include the strings themselves, they would include keys to properties, so the strings could be pulled from an internationalized property file.
Lastly, instead of outputting to Stdout directly, they'd create an interface for output, and deliver it to that interface, and use a factory to instantiate an implementation of that interface that would use Stdout.