Keep It Simple, Stupid | |
PerlMonks |
Re^4: Seeking Best Practices - does your company follow a standard?by cleverett (Friar) |
on May 06, 2010 at 19:19 UTC ( [id://838780]=note: print w/replies, xml ) | Need Help?? |
Piffle.
That you have to imagine cases where 2000 line subs are preferred, tells me exactly how often such cases really occur: almost never. In 10 years of coding Perl for a living, I have never seen a 2K LOC subroutine that wasn't 90% scaffolding that should have been abstracted away into other modules, with the remaining 200 lines doing 5 to 10 different things that should have been tucked into their own, nicely named subroutine. Programmers will use their first working solution as a template for every similar project, you can bet the codebase is a massive pile of cut and paste, long past being maintainable. The issue isn't one one of arbitrarily counting elements of syntax, but clarity of expression: at every level, any reasonably experienced reviewer should be able to see what the code is doing and how it fits into the big picture, without having to think about it. 2000 line subroutines require exponentially more time to understand and review than a group of small subroutines, because they require exponentially more time than the 10 to 20 smaller (by 2 orders of magnitude) subs a decent implementation would probably use. If 2000 line subs are common where the man works, something his company's programming culture is badly messed up, and nothing short of wholesale replacement of the entire development staff from the top down will make things better. He should get out before that culture infects him to any great extent.
In Section
Meditations
|
|