Home > Archive >  2007 >  November >  28


Programming less

Wednesday, November 28, 2007 by Dave Winer.

A programming lesson I keep relearning. Permalink to this paragraph

The design of the central data structure of an app determines the quality of the app, in every way. Permalink to this paragraph

Any extra thought that goes into this, will pay off in:  Permalink to this paragraph

1. Maintainability of the code. Permalink to this paragraph

2. Size of the code (you'll write less code with a well thought-out central data structure). Permalink to this paragraph

3. Simplicity of the user interface (the structure inevitably shows through in the UI). Permalink to this paragraph

4. Ability to respond to feature requests. Permalink to this paragraph

5. Adapt to new hardware, OS changes, other apps. Permalink to this paragraph

6. More "it just works" experiences. Permalink to this paragraph

This is why it's sometimes the right thing to start over from scratch. Programmers often want to start over because they look at the code and it looks complicated, and they think they can make it simpler if they start over. They're right, of course, it will be simpler when they start over, because it won't do nearly as much as the mature product does. Once they finish building out the feature set, it may well be just as complicated.  Permalink to this paragraph

It's a judgement call. I remember looking at the source of Unix kernel for the first time as a grad student in Wisconsin, and being amazed at the simplicity and obviousness of the code. I couldn't believe something so simple actually worked. Your code at its kernel level must have this simplicity. But at the edges, where you're accomdating the minds of users, inevitably it gets a little messy. The key thing to look for is how hard is it to add a completely new feature. It should be easy to do that. If it's not, it's likely because of a poorly organized (and therefore not well-understood) central data structure.  Permalink to this paragraph

I've rewritten apps many times, over many years, because when I wrote the first or second versions, I didn't understand the problem well enough, and the code had turned into a morass of patches and workarounds.  Permalink to this paragraph

Right now I'm recoding the internals of a special-purpose aggregator. I've written many of these, over the years, always quickly, trying to get something running fast, and then lived with data structures that resulted. This time I'm going slowly and carefully, with an installed base of one (me) and ripping up the pavement whenever I find even a slightly better way of doing something. I have other users who are waiting, but that's life. ;-> Permalink to this paragraph

5/7/97: "When a programmer catches fire it's because he or she groks the system, its underlying truth has been revealed." Permalink to this paragraph






© Copyright 1994-2007 Dave Winer Mailto icon.

Last update: 11/28/2007; 11:10:09 PM Pacific. "It's even worse than it appears."

Click here to view blogs commenting on  RSS 2.0 feed.