17 August 2012

You Should Not Hier Me

Once again, into the reading list. For, at least, the second time it's Wilkinson's "The Grammar of Graphics". A wonderful book, if only as book. Real binding (not quite Smythe, but as close as it gets these days) "With 410 illustrations, 319 in Full Color".

But then, on page 3 (yes, that fast) he conflates objects with design patterns. What's worse, in the preceding paragraph, he cites Meyer's OO book first among equals. Then, the last sentence of section on OOD, thus: "Because of this generalizing tendency, object-oriented systems are intrinsically hierarchical." Well, no. (I finally understood how OOD really is supposed to work, and by supposed to I mean such that the exercise maximizes the benefits while minimizing the pain, when I read Allen Holub's pieces in the mid to late 90's. Near as I can tell, he's subsumed himself to the Borg since then, writing ActionClass and DataClass like all the other morons. But to see what OOD is all about, read up his Bank of Allen. It is truly eye opening; more so even than Meyer, who was still stuck in bifurcation mode a bit.)

Well, no they're not. In fact, not even family trees are hierarchical, nor are organization charts. The real world is inherently relational. Back in the Good Times of 30 BC, when a man could divorce, kill, or otherwise dispose of a bad wife, patrilinealism was probably 99.44% likely. Not so today, what with serial polygamy (and the real sort in certain states). In organizations, matrix management has been around for decades, so the strict super/parent meme hasn't been true there, either. Coders spend a good deal of time forcing the real world into their inaccurate framework. I've long since forgotten the cite (and I've kept looking), but a wise person once said, "there's more hierarchies in code than in the real world".

I've been pondering for years why it is that IBM made IMS when IDMS (the network mode database) was there for the asking? Why did IBM shunt Codd aside when time came to write the data language for the RM, and install an IMS cowboy? Why did xml flummox so many? Why this inherent belief in what is obviously not true: the universality of hierarchy? Why do so many Emperors strut around in new clothes?

At this point, the answer appears two-fold. On one hand, coders don't want to be made redundant by the database developers, since doing things relationally moves the logic into the database where it belongs. Nor, for bureaucratic reasons (the one with the most worker bees holds the hammer) do the coders' supervisors. Thus a regime which keeps the data as dumb as possible is preferred.

The second motivation is less evil, perhaps. To implement hierarchy, one need only write some client side code, since there's no interaction outside of this construct; anyone who's battled with an XML Schema (xsd) knows how much cruft results from taking naturally relational data and twisting it into a "document". What happens with (organically normalized) relational data? Well, one needs a data manager to resolve the relationships. A God Process, which OO folks deny is ever, ever used in OO applications. They blithely ignore the fact that 99.44% of OO applications are written under the control of A Framework; that dang God Process again.

So there you have it, the atheists win.

No comments: