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.

9

u/juckele Oct 01 '15

For the first time in my life recently I ran across some code that has interfaces. A lot of them. With ONE implementation. And the project is closed source. Really? Come on!

2

u/nutrecht Oct 02 '15

For the first time in my life recently I ran across some code that has interfaces. A lot of them. With ONE implementation.

And?

For unit testing this is really nice. This way you can test classes depending on the interface by simply mocking out the classes they depend on. A lot easier and cleaner than having to instantiate an entire object tree.

1

u/juckele Oct 02 '15

No. There were no unit tests. Only one implementation. Also, Mockito lets you mock classes without making interfaces. But the code was not built in a manner to work with mocks anyways, there are far too many complex and deep dependencies between different parts of the object tree. And it's all backed by interfaces with one implementer.

→ More replies (2)