»
S
I
D
E
B
A
R
«
The Curse of Object-Relational Mapping
Nov 24th, 2008 by dachaeon

I had a professor in my software engineering program at UT who said that “Code is the dessicated relic of a long intellectual process.” I have never heard it put better. I am a big believer in the “Say it in code” principle - that your code should be simple and readable enough for others to understand (or at least yourself when you look at it again a year later and wonder “Who wrote that mess?”). Experience tells me this is not sufficient. Object-Oriented Analysis, Design, & Programming (OOA,OOD,OOP,OOAD,OOADP, or OOADD for those with short attention spans) has proven itself to me as the best available technique for maintaining the original intent behind code - after all, the behaviors and the state live together in modules that encompass a domain concept - if we have done our jobs.

OOADP also gives us more tools in our toolboxes for tackling complexity problems - if you look at the classic Object Oriented Analysis you can see that while functional, procedural, and data-flow techniques are suitable for certain classes of problems, an OOADP approach encompasses those and adds flexibility - especially in complex interactions of part-whole, is_a, has_a, and acts_like_a domain relationships.

By the way - the most under-read book on OOP is Streamlined Object Modeling.

Streamlined gets us the rest of the way there on being able to look at a system years later and understand what is going on. The appropriately-named DIAPER process “catches all the crap” and the whole book presents a dozen patterns (most of you probably think of these as analysis patterns) based on about a hundred principles - along with sample code for Java and Smalltalk.

I think the beauty of Streamlined is that by taking some decisions away (constraining our design and coding to the dozen patterns), we are freed to focus on the problem domain. It helps by reducing the arbitrary complexity that Brooks bemoans in The Mythical Man Month - because when you go look at a Streamlined object you know where to find stuff and you can quickly grasp how it interacts with other objects to get the job done.

And all is well with the world. Well, not quite. You see, in the real world these days - even if you are cool like us and write Ruby on Rails Web Applications - most of your system state resides in a relational database. Sigh. The Object Relational Mapping problem has served as some great fodder for theses and dissertations - not to mention lots of consulting dollars. Because at the end of the day all of that extra power I was bragging about object-think having over data-flow or functional or procedural or whatever older programming technique your technology stack forced upon you - all of that gets diced to shreds when you start to bolt your system onto the relational database.

Inheritance is a problem for databases. Single-Table or Multi-Table - you want to be able to collect, select, inject on your sets of objects without doing an 8-way-join? Sorry. Cost of doing business. Cache your app like mad and keep going.

OK. That works fine for toy apps. And I good-naturedly include any app where the domain complexity does not overwhelm the technical issues - even if you are generating a billion hits-per-second or whatever you lucky dogs are doing these days ;) no jealousy at all there friends!

What I am trying to get at here is that even with a powerful abstraction like Active Record (see Martin Fowler’s book Patterns of Enterprise Application Architecture for the general case and Ruby on Rails for an incredible implementation) - any time we have to think about the fact that there is a database under there it detracts from the ability of the development team to maintain momentum on new features and the evolution of the system as a whole.

The nature of a business application is to change - I cannot recall the name of the classic paper - but business apps were categorized a long time ago as a system which is not simply simulating the world - it simulates some things sure - but it also changes the world as soon as it is released. A good business application provides the business with capabilities it did not have before. And as soon as a business has new capabilities it will capitalize on them - you guessed it - there will be immense pressure to change the system to provide new capabilites built upon those just created.

That is a good summary I think of why software is a lucrative field and why thinking practicioners of the software art need never fear running out of cool work to do. Each time we innovate for our customers or our employers (they are our customers too after all) - every time a new system leaves the abnormal state of the lab and starts breathing in the real world, it better be solving some key business problem. Then those customers are going to look around and say “Wow! If we can do this, then what about …”.

So we need to stay fast and agile - ready to respond to those wonderful changing business requirements that let us know the system is still alive and still being used to do stuff. And a relational database makes that problem a little harder.

Am I just ranting? Mostly. But there is hope for us OO purists. Seaside can run on Gemstone - an object store that persists state across servers and on disk (the way most of us use the database) without having to wrestle with the ORM problem. And I have long had a desire to really learn the Smalltalk way of doing things - but so far I have not gotten around to it. So what really melts my butter these days is Maglev - a project to make the Gemstone architecture support Ruby (or a project to make Ruby run on the Gemstone architecture if you like).

It bugs me that the Rails community is not talking about it more of late - my impression is that since it is not open and free (yes, Gemstone is made by a real company and they stubbornly wish to keep the system proprietary) that the community wants to ignore it. I have been scouring the web for press on the RubyConf2008 talk about Maglev, and I have found only a couple of tweets! I am waiting with bated breath for Confreaks to release their videos so I can finally see what I missed.

I think we can at least talk about the technology. Gemstone does have a free license for many classes of application. And for those of us with big systems like mytoons.com - we’ll just have to negotiate :)

Finally a little encouragement to the Maglev team themselves - lets get some blogs going and an alpha or a beta out there to experiment with. I am ready to turn ActiveRecord into a no-op! Well, at least an abstraction where I don’t have to worry about inadvertantly introducing a database crippling query into the mix by asking my object model an interesting question. Cheers for turtles all the way down!

The Crisis of History
Nov 24th, 2008 by dachaeon

In Witness, Whittaker Chambers notes that feeling men of all stripes cannot help but be moved by the plight of their fellow man as they stuggle through the world - daily facing the curse of the world and struggling with disease, poverty, injustice, and death. He observes that the Communist is responding to this crisis by trying to ensure that all men are treated justly. The truly idealistic Communist seeks the good of all in his effort to promote a fully egalatarian society through the power of government.

The results of the last election affirm the insight of Chambers in stating that you cannot fight such a revolutionary spirit by simply standing for the status quo ante. The furor of the revolutionary can only be overcome by a counter-revolutionary spirit that is just as zealous in standing for an opposing principle.

Many pundits these days are rejoicing or mourning the death of conservatism based on a cursory analysis of the last election. There is ample bickering within the Republican party about the decisions made in the campaign and about the reasons for their defeat. I have heard of several who espouse a more moderate party going forward to try to win the middle and stand against the extreme liberal (socialistic and even communistic) forces represented by President-Elect Obama and his forthcoming administration.

It seems to me that the lesson of history, and the wisdom of Whittaker Chambers in particular, rails against such a course. It is not a moderate or lukewarm philosophy that can stand against the power of the revolutionaries who want to turn the United States into a mothering, protecting entity that will at least ostensibly attempt to provide justice and succor to all. It seems to me that what is required is an empassioned, articulate defense of the principles of liberty that conservatism represents.

What is required is a shout from the rooftops that socialism and communism are evil - that even though these concepts seem prima facie to be noble and good, they make great promises about the good of society and being fair to all - they fail to account for the fact that every human being has a soul. That to oppress the soul of a single human being for any well-meaning cause is to commit the greatest of atrocities. The abstract good of the collective can never be allowed to cause harm to the individual. The conservative also desires to save the world - but one life at a time, one family at a time - in the small, but also in the concrete. This is why The Forgotten Man must never be forgotten.

President-Elect Obama made a comment on the stump about selfishness. His claim is apparently that the desire of an individual to act as a free moral agent - making his own decisions about his life, liberty, and property - constitutes a selfish act. The desire to reduce the scope of government - and lets not forget that government exists by consent of the governed - and act freely with the ability and substance that we have - is not selfish - but simply the only sane course of action. In a masterful verbal pivot he compares his childhood act of sharing his own lunchtime sandwich with another child to the federal government taxing working Americans and redistributing those funds to others. This is more akin to a young Obama forcing one child to give a portion of his sandwich to another.

About the blog
Nov 22nd, 2008 by dachaeon

Greetings friends, family, cohorts, peers, etcetera, etcetera, etcetera!

I expect the focus of this blog will evolve over time - but for the moment I plan for this public diary to span personal, political, and professional topics ranging from Software Engineering to liberty to the value of human life - body, soul, and spirit.

I have read that most blogs are read by at most a dozen people - so I will approach this public/private endeavor with an expectation that most of my readers are already acquainted with me in some way. Clay Shirkey makes some great observations about the weirdness of this phenomenon in his book Here Comes Everybody - writing a blog is like having a conversation in the food court of a mall - it is sort of private, but eavesdroppers abound. In the blogosphere however, this behavior is encouraged :)

»  Substance: WordPress   »  Style: Ahren Ahimsa