Tuesday, February 15, 2005

Asymptotically/almost perfect

I do not know about other bloggers, but the first rendition of what I write usually leaves me satisfied but not excited. So I come back to it, read it, fix it some, and so on until I am happy. It happens with my posts all the time.

Finishing the hymnbook made me remember how much time my mom and I spent fixing typos and improving wording that could have been attributed to Yoda. Since I switched to LaTeX, I had to refactor the programming of every hymn to make it look better. I hope I haven't introduced any errors - my previous TeX edition had exactly three typos!

It's impossible to achieve timeless perfection, but it's so nice when you get close to it for a moment! It's actually good that you never get there, otherwise you would stop trying and that takes out the fun.

And keeping in mind the work on the hymnbook, I believe the same is true with refactored code. I learned Smalltalk about 9 years ago. Soon after I started, I heard all the new buzzwords about refactoring. The comment at the time was that refactoring was something you did after you hacked your way through, that it was hard, kind of a non-mandatory extra... a chore.

And I remember thinking: "it may be difficult, but if I practice enough it will be automatic and I will write desirable code by default".

I am so happy I forced myself to apply all the refactorings I learned about, because now they come out naturally. With practice, it takes way less time and effort than dealing with your code's shortcomings. And it becomes so much easier to do maintenance and to change stuff!

The cool thing is that by the time you think you have mastered a skill, you will have learned something new to practice.

No comments: