3 Nov 2008

Rule of Representation

I have been doing some studying on the internet in my free time (not that I have too much of that nowadays) and I stumbled upon the Unix Philosophy. This is a philosophy, not method, for building programs and systems.
As I went through the rules, I found something interesting. I'll paste it here:

Even the simplest procedural logic is hard for humans to verify, but quite complex data structures are fairly easy to model and reason about. To see this, compare the expressiveness and explanatory power of a diagram of (say) a fifty-node pointer tree with a flowchart of a fifty-line program. Or, compare an array initializer expressing a conversion table with an equivalent switch statement. The difference in transparency and clarity is dramatic. See Rob Pike's Rule 5.

Data is more tractable than program logic. It follows that where you see a choice between complexity in data structures and complexity in code, choose the former. More: in evolving a design, you should actively seek ways to shift complexity from code to data.


I have read in the past many articles about how data trumps programing algorithms in many cases and I know that Google uses this principle on their searches. Its just nice to see that its been thought about and discussed in the days of when Unix was thought of.

No comments:

Post a Comment