Re:Tips on reading and debugging other programmers' code
by commandlinefan on Sunday February 16, 2020 @09:41AM
(#22341730)
If it even can be tested. I’ve spent decades now dealing with beginning Java programmer’s preference for the relative simplicity of static initializers; that is, code that starts trying to connect to a live database as soon as you run it in a way that can’t be mocked out without making dangerous changes to the code in the first place.
[ Parent
| on HN ]
Re:Tips on reading and debugging other programmers' code
by nitrogen on Sunday February 16, 2020 @02:37PM
(#22343345)
There are improved mocking libraries these days with much more power, so the everything-must-be-an-interface pattern is no longer required most of the time.
If writing testable code means writing obfuscated code, it's a good sign that the language ecosystem needs to improve, and for Java, it has.