Tip #1 for writing better code - edit. With this book I write, I find I'm spending more time editing than writing. The first draft is usually bad. The first draft "works" in the sense that it covers the material, but not necessarily in the best possible way.
Same thing with writing code, it's one thing to have the code working and it's a separate thing to have the code easy to understand, efficient, maintainable, expandable. When you're working on a problem, sometimes you just try different things. One of them works. It's your job not to stop there but to edit this first draft. Don't commit first drafts.
There will be junk. It's up to you to make sure that junk doesn't find its way to the final product, only because "it works". It may work now, but how about tomorrow. Is your code fit for print?
This entry was posted on Monday, February 18th, 2008 and is filed under misc hackery, writing. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.