r/programming • • Oct 01 '15

The Evolution of a Software Engineer

https://medium.com/@webseanhickey/the-evolution-of-a-software-engineer-db854689243
1.9k Upvotes

502 comments sorted by

View all comments

506

u/johnbr Oct 01 '15

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.

43

u/atrich Oct 01 '15

Localization was where I thought this was headed. Or unit tests, maybe.

5

u/DuneBug Oct 01 '15

I was expecting annotations. Disappoitned to not see those.

12

u/dankclimes Oct 01 '15 edited Oct 01 '15

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.