On code quality: rewrite once
blog.tetrack.com
On code quality: rewrite once
1–10 of 14 posts
Re: On code quality: rewrite once
#2Re: On code quality: rewrite once
#3Re: On code quality: rewrite once
#4Isn't this what refactoring is ? As you mature as a coder, you will be able to write good code for certain standards which need not be thrown away. So having a look at the code and fixing the crappy portion will be more productive than throwing away the whole implementation. I think whole rewrite rule is useful when you start working on a new technology... but if you are using a stack for considerable amount of time,…
Re: On code quality: rewrite once
#5So yes, its best to try to write it correctly the first time, but its ok to rewrite it a second. After that, you should probably look as to what you're doing wrong.
Re: On code quality: rewrite once
#6For example the library Powerplant (Metrowerks' mac equivalent to MFC) was rewritten a dozen times before it was released, as its design patterns needed a lot of fishing out to get them right.
Re: On code quality: rewrite once
#7Isn't this what refactoring is ? As you mature as a coder, you will be able to write good code for certain standards which need not be thrown away. So having a look at the code and fixing the crappy portion will be more productive than throwing away the whole implementation. I think whole rewrite rule is useful when you start working on a new technology... but if you are using a stack for considerable amount of time,…
At the moment, I'm working interfacing a handheld device with a networking device. I quickly wrote a prototype to work out implementation details (since connectivity required using a particular protocol). That's not to say I didn't write parts of the prototype to be refactored or pulled out, but given that I had to do a fair amount of exploratory programming to determine the best implementation, much of the prototype code will be thrown away.
Re: On code quality: rewrite once
#8I kind of have a vague feeling for why this would be true, but I can't quite put it into words. Maybe it has to do with how much structural stuff I have to write, or how directly I can express my program in the first place. Thoughts?
Re: On code quality: rewrite once
#9Re: On code quality: rewrite once
#10OK to rewrite the really bad stuff that has a high density of bugs. OK to adapt your architecture if it really doesn't fit the problem domain you are discovering and you really can make it simpler. OK to clean up basically ugly code that neither you nor others can easily understand. The important thing is to have a good reason to rewrite besides "I always do it that way."
Always rewrite from scratch on principle? This is the path to madness, failure, project overruns, and downright disasters. That is unless you are very very lucky. Luck helps but good software is not produced by luck.