Thoughts of a programmer

How long is long?

How long should a method be, for us to consider it to be too long?

20 lines?

10 lines?

Fit into a window without having to scroll?

It's not as much about the number of lines of code as it is about levels of abstraction. A method is too long if it deals with more than one level of abstraction.

Here's a poetic rendering by Tim Berglund (source: http://www.youtube.com/embed/3QbheQitF74).

Things you will need: http://nofluffjuststuff.com/s/images/bio/26273_Berglund_20120107_222639_medium_sq.jpg http://www.agiledeveloper.com/video/timOnMethodsYoullCompose.mp4 http://www.agiledeveloper.com/video/timOnMethodsYoullCompose.ogv
Comments

John Doe

http://www.example.com

How to break the bad practice?

We all know that writing long method is evil. Yet, there is so much of that in real-world applications. Do you have suggestion on how to break that bad practice?

Add your comments