The "I'll have Larges Fries and a Diet Coke" Style of Programming
I was at a local fast food joint today and a fairly large individual in front of me order a Double Cheeseburger, Large Fries, and a Diet Coke. The irony was as big as his backside.
An hour later at work a fellow identified an opportunity to reuse some code (Diet Coke = Good) but in the interest of schedule, ease of deployment, the differenting contexts the original code was used in, changes to the installer, etc. etc., the quickest way to use the code was by copying and pasting (Large Fries = Bad) from one subsystem to the other.
Ordinarily this would have killed me a little inside, but...sigh...at least it was a Diet Coke.
Was I wrong?
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
If you were REALLY referring to the Diet Coke, then I have to say I know folks who only drink Diet b/c they think it tastes better than the original.
I think I see where your comming from with you thoughts on this. For myself, this low carb kick of flagging what is good and what is bad on the menu board took less brain power than lifting a morning cup of coffee. With only thirty minutes to eat between work and class, these easy-to-learn flags are all most anyone needs.
For the gentlemen who's irony was thicker than his backside, attention to atleast some of this detail may not be such a bad idea.
Copy and paste a code is not a good idea, but it's the simplest way.
But at least it was a diet coke .... But at least it was a good code.
Depending on the deadline, sometimes we have to give up the elegance.
* Copying and Pasting code is bad, much like an order of Large Fries.
* Attempting to reuse some code is good, much like ordering a Diet Coke, rather than a Regular Coke.
The question then is, is it good that the programmer attempted to reuse code? Or bad that he just copy/pasted?
Analogy? :)
Ya, the good was good, the idea was good, the issue was that they could copy/paste in 15 seconds, or take 4 hours and refactor the code they needed from where it was to a utility class that wasn't bound to a particular context. So, then punted and copy/pasted with a few changes.
regarding this:
>The real question is was the code that they copied the right solution or not?
no the issue here is that even if the code is the right solution, by copying it all future maintenance is made harder because there are now two places to maintain the same code.
cheers
leon
Comments are closed.