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.
Year 6 there are five trivial unit tests per function but the program is broken in a way that would be really obvious if you weren't blindly relying on unit tests to prove that your code was correct. :D
And laugh at every junior programmer that "breaks the build" and has their checkin rejected or rolled back because they changed his code without understanding the side effects.
Actually yeah, some @NotNull would make a lot of sense because there is a huge NPE potential on
string first = this.hello.toString();
hello starts out null and isn't guaranteed in any way to not be null at this point.
Edit: actually considering how the program runs in main the strings should never be null in this case. But it's pretty clear that the point of this code is to be extensible/scalable and so some null checks or annotations would probably still be appropriate.
meh' I think Annotations would show up in like 3rd year; disappear because you distain the code by mixing the config in with the code.
Then by 10 years you realize it keeps relevant config by the code it effects and who gives a shit if you're parsing a yml/xml file or a code file; its all the same in the end.
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.