Sunday, December 05, 2004

Precious Thoughts

I have a moleskine notebook, and yet I hardly ever write anything in it. It is a beautiful little book, that has this incredible feel of permanence when you hold it in your hand. Every time I open it, I imagine that I am writing something that my grandchildren might one day read.

So, of course, I hardly ever write anything in it.

It is not that I don't value my own thoughts, but that I find it exceptionally difficult to think while simulatenously criticizing what I am thinking. I can only manage to write anything by first spewing out everything in my head, and then going back and editing the resulting mess.

Programming is a lot like writing. It is hard to get everything perfect the first time around, so you hack things out the best that you can, and then make a second pass, fixing the mistakes you made the first time. You only get into trouble when the decisions you made in that first pass are difficult to change, like the notes in my moleskin.

So here is yet another way to define the term "loosely coupled":

Your code is loosely coupled, when you have contrived to house all of your difficult decisions in their own components, so that you may change those decisions without having to touch any other component.