Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Are design patterns worth it?

by stephen (Priest)
on Aug 28, 2002 at 17:37 UTC ( #193518=note: print w/ replies, xml ) Need Help??


in reply to Are design patterns worth it?

I don't think you have a problem-- or if you do, you also have the solution. You recognize the difference between "maintenance minefield" and "good, well-documented, loosely coupled, easy to maintain code." Once you've got that distinction, you can refactor the minefields into grassy plains as you need.

Design patterns do not define good design. They merely specify one way of getting there, and serve as examples of it. If the code is expandable, documented, and orthogonal, I don't care if it's DP-based or not.

My usual method of dealing with partially muddy designs is as follows:

  • If the code works and doesn't need to change, I don't mess with it. I write automated unit tests for it as a background task, just in case I ever do need to fix it.
  • If I need to make a change, I start by checking my unit tests to make sure they test things out well. Then I refactor bit by bit.
  • If the code doesn't work, then I'll rewrite it-- or at least the broken portions.

The only worry about bad-but-working code is the fact that bad code begets bad code. If I'm working on a project that uses a lot of globals, it's always tempting to add more globals in my new code... after all, why not? There are globals there already. It's a quick downward slide to coding cynicism.

My interactions with a Big Ball of Mud are detailed in Failure To Refactor.

stephen


Comment on Re: Are design patterns worth it?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2014-12-26 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (164 votes), past polls