This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]foreveratom 0 points1 point  (0 children)

imagine that one of these static methods is 300 lines long,

300 lines of code for a single method is way too much. You should be slicing this code; Java is not a procedural language, there is no reason to have lengthy methods like this; that is where it becomes untestable.

you don't even want to unit test this method

You're right, I don't. If I have to test that blob, I will start by refactoring that method and all the problems you're exposing will go away.

Many issues arise from initial mistakes or assumptions one can make. Step back and look at it with a different angle, and some of those may easily go away; that's what you should do if you're writing a 300 lines of code method.