Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Writing general code: real world example - and doubts!

by Steve_p (Priest)
on Apr 04, 2005 at 19:55 UTC ( #444777=note: print w/replies, xml ) Need Help??

in reply to Writing general code: real world example - and doubts!

Unlike some of the other advocates for refactoring, I don't think refactoring should be done just because I can. There should be concrete reasons for messing with production code other than, "This way looks cooler." A quick cost/benefit analysis should be done. It shouldn't require an accountant to do it, but you should be able to show that your refactorings will provide some sort of tangible benefit, either in terms of significantly improved performance or decreased maintanence costs.

I do, however, have a few rules of thumb where I will refactor nearly every time. If the code is similar enough to other code where I can generalize (or is a cut and paste copy), I refactor into a generic module. If changes in other code will cause changes in the module I'm looking into, I refactor to break the dependency. If a change will make the code harder to test, I refactor to something that can be tested.

  • Comment on Re: Writing general code: real world example - and doubts!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2021-04-18 09:53 GMT
Find Nodes?
    Voting Booth?

    No recent polls found