After how much line of code a function should be break down?

Posted by Sumeet on Programmers See other posts from Programmers or by Sumeet
Published on 2012-06-29T11:16:44Z Indexed on 2012/06/29 15:22 UTC
Read the original article Hit count: 307

While working on existing code base, I usually come across procedures that contain Abusive use of IF and Switch statements. The procedures consist of overwhelming code, which I think require re-factoring badly. The situation gets worse when I identify that some of these are recursive as well.

But this is always a matter of debate as the code is working fine and no one wants to wake up the dragon. But, everyone accepts it is very expensive code to manage. I am wondering if are any recommendations to determine if a particular Method is a culprit and needs a revisit/rewrite , so that it can broken down or polymophized in an effective manner. Are there any Metrics (like no. of lines in procedure) that can be used to identify such segment of code. The checklist or advice to convince everyone, will be great!

© Programmers or respective owner

Related posts about code-quality

Related posts about refactoring