Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^2: Working with old code

by haj (Curate)
on Jun 27, 2020 at 14:03 UTC ( #11118608=note: print w/replies, xml ) Need Help??

in reply to Re: Working with old code
in thread Working with old code

I don't get what people dislike about a 100+ line method/function/subroutine if it has no reason to be split and it the chuncks in the sub have been well separated and commented.

I agree that long subroutines aren't necessarily evil. It depends on the case: You have listed some conditions... which quite often aren't met in old code. Subroutines grow, because, let's just add a small feature here, because of why not, only one source file to be changed, and then there's another edge case to be covered, let's just copy that check from the other file where it works just fine. So in my experience long subroutines are often due to "maintenance with small commits", so to minimize the effort for code/patch review, and not because the subroutines were designed that way.

BTW: My most recent bugfix was in a 1120-line sub, mostly written in the previous century, and guess what: Now it has 1123 lines. And I'm not going to split it anytime soon.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11118608]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2021-09-18 20:41 GMT
Find Nodes?
    Voting Booth?

    No recent polls found