Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Simplicity vs. Doing It Right

by dvergin (Monsignor)
on Oct 13, 2002 at 04:03 UTC ( [id://204854]=note: print w/replies, xml ) Need Help??


in reply to Simplicity vs. Doing It Right

Yup! I can think of several "dirty little secrets" in the project I am currently responsible for. Quick-hack data extraction from some simple XML generated in predictable ways only within the current suite comes quickly to mind.

Which brings me to the matter factoring these little nuggets. As often as I can, when I commit one of these "quick solutions," I wrap it in such a way that later, when things get more complicated, it will be easy to exchange the "adequate hack" for some serious code.

The slippery slope of quick hacks embedded in code that has a future is when we later find ourselves writing around the inadequacies of the quick hack instead of fixing things. I try to set up subroutines that claim to do the job robustly even though a quick glance at the innards makes it obvious that their capabilities are limited. Later when the routine stumbles under new demands, I fix that subroutine rather than adapting the calling code to the limitations of the quick hack.

My ability to predict which well-wrapped quick hacks will need this attention in the future is far from perfect. (Which is why Extreme Programming counsels us not to spend too much effort solving problems that have not yet come up.) I have said two years later "Yee Gads! Is that functions still doing the job? It was just a placeholder." as often as I have said one month later, "I thought sure I had anticipated everything in this block!"

And often when something breaks, there is the wonderful 'Aha!' moment... "So that's why it's safer to use the recommended module!" Those are the lessons that stick.

I think quick hacks are fine if documented and factored properly. I would even argue (XP-ishly) that effective programming is a constant process of weighing wisely the least you can do to produce code that does the job now and lends itself well to future modification.

------------------------------------------------------------
"Perl is a mess and that's good because the
problem space is also a mess.
" - Larry Wall

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-29 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found