Keep methods short

Last Update: 14.09.2018. By Jens in Newsletter

I am working on the project from the stone-age again and some devs definitely had a knack for writing long methods. Very loooooooong methods.
The longest one I was analyzing yesterday was roughly 4 or 5 screen heights long (laptop) with lots of conditions and loops. It was hard to follow and I lost several times where I was in the logic.

I don’t think there should be a hard limit of how long a method can be. But it should be as small as possible and as it makes sense to understand it. The latter is more important. A method should be readable and understandable. It is not if we loose track of where we are.

As a guide, if it reaches the height of our screen, take a closer look if it makes sense to split it up.