To rebuild or add another boolean?

I just added this to my non-existent coding diary, and the specifics won’t make much sense to anyone but me. But the experience would be immediately recognizable to anyone who has worked on a complex project for any length of time. As usual, ignore what you don’t understand. 😉

I recognized the pattern, there was spaghetti starting to envelop my new CMS code. This happens when you add special cases by adding boolean parameters to routines. That happens because when you wrote the high level code initially you didn’t fully understand the problem.

The question is did you leave yourself the room in the schedule and with regard to potential breakage to actually rebuild the code so it correctly achieves its purpose? So when you read the code it looks like the pseudocode you’d write when conceiving it? If it’s complicated enough and important enough — it’s worth the time to factor and re-factor until it reads like documentation of its functionality.

Too often you can’t go back and re-engineer it, and you live with the bad construction. Then the code is fragile its whole life, so you don’t build new layers on top of it, or if you do they’re either inefficient or missing obviously valuable features.

I decided to rebuild this time. The problem was confusion over how and when index files would be built. What I realized was the code was optimized for minimizing the amount of stack building. When I got to that point in the rebuild, I added a cache, so the upper level code could be totally simple and natural. It worked!

Now the question is can I use the software for its intended purpose? I was able to do that before. Can I still do that?

See also: We Make Shitty Software.


About Dave Winer

Dave Winer, 54, pioneered the development of weblogs, syndication (RSS), podcasting, outlining, and web content management software; former contributing editor at Wired Magazine, research fellow at Harvard Law School, entrepreneur, and investor in web media companies. A native New Yorker, he received a Master's in Computer Science from the University of Wisconsin, a Bachelor's in Mathematics from Tulane University and currently lives in Berkeley, California.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s