If you’ve ever done a couple of interviews, you’ve probably got the “I’m a perfectionist” candidate. When asked about its flaws he says with a fake-hidden smile: “I’m a lil’ bit of a perfectionist”, thinking deep in their mind this is more of a good thing then a bad one. Perfectionist, those people that only craft perfect thing, only the best (by the best), free of any flaw (except being too perfect), a piece of art left to be admired, not touch by anyone even it’s creator!
Well, that might be good for some poor artist on crack but we’re not! We’re developer driven by business rules, deadlines, changing requirements, technology and coffee. Unhealthy perfectionism is like the big bang approach to integration. It’s all or nothing, but most of the time, it’s nothing.
Here are 5 ways to bring your software closer to perfection, bits by bits, while still shipping your damn code (no crack required).
1. Small changes
Making 1000 lines of code perfect in a respectable amount of time is impossible. But tuning 10 to perfection is easy and fun. It’s also easier to wrap your head around the tiny problem you’re trying to fix.
It’s even easier to do this when writing tests, they help you split a complex problem into smaller and simpler ones and focus on one, one at the time. Hack some code, make the tests pass, commit, update and repeat.
2. Every single change should make the whole better
Incremental Perfectionism, is like the poor-artist-on-crack perfectionism on a smaller, healthier scale. Don’t try to make the whole thing perfect. But never ever settle for something that is not the best possible solution to the small problem you’re solving. Don’t copy paste some code because it’s easier, don’t comment out a block of code because it’s faster, don’t live with ugly code. But don’t fix it all at the same time!
3. Refactor, refactor and refactor
Perhaps your understanding of the problem has evolve or you’ve learn a new and better way of doing something. Backed by a bunch of solid tests, listen to the code artist in you and refactor! Make the code beautiful, gorgeous, a piece of art, more perfect! Make the tests pass, commit, update and repeat.
svn -R revert .
If you feel you’re breaking any of the previous rules, start over. Maybe your changeset is getting too big. You’re trying to change too much things at the same time. If you’re afraid to loose your precious code, commit your working copy to a branch:
or create a patch:
svn diff > my_precious.diff
then, step on your ego and
svn -R revert .
But since we’re working with small changes, you haven’t lost that much right ?
5. Read lots of code
A good way to trigger your imagination into moving your software closer to perfection is too look at how other people are trying to do it. Open source projects are open books into some of the best programmers mind. They’ve spent time trying several ways to solve a problem, don’t spent your time doing the same thing!
I hope you find this helpful. Let me know how you’re making your code more perfect!