Home SubSonic MVC-Storefront

More OODB Crazy Talk

I listened to the Alt.NET Podcast the other day and there was a crazy guy who sounded an awful lot like me on there talking about Object Databases. Doesn’t he know they’re not cool? He must have some kind of career death wish – the need to trash his reputation (or create flame-bait) in the name of Something Fun To Do. I’m not sure he elucidated his thoughts very well, so I’m here to help him out with some details that many of you might not be considering.

There’s a Difference in Your Data
One major point that didn’t come out in the discussion until the end was the idea that your application deals with different “types” of data at different times. endless_summerYes, I know this sounds weird, but consider it for a moment in terms of the Road Trip. Let’s roll back to college for a moment – your buddies want to head to Ensenada for the weekend, and you need to figure some things out before you go:

  • There are people involved – how many are coming?
  • Depending on the amount of people, you’ll need some cars to transport them
  • No road trip is complete without roadtrip tunes – you’ll need some groovy tunes to listen to
  • Junkfood! You have to have some of that for sure!
  • Camping supplies (which usually is a towel to sleep on and more beer to pour over the little boxes of Cap’n Crunch – called “Crunch Bombs” – in the morning)

That’s probably enough. In this we have our Ensenada Domain Model – all of the “objects” we’ll need to have a good time on our Road Trip (I’m sure you can think of more, but I’d like to keep this post PG, at least). These objects comprise what I’ll call “Functional Data” – the stuff you need for your application to properly engage the user.

The next type of data is “Derivative” or “Resultant” data – the stuff that comes out of the application experience.  You can think of this as the result of a User’s experience with your application – the choices they make, the stuff they view, the behaviors they exhibit when interacting with your creation. This type of data has no upper bound, is time-stamped, and is ultimately what the stakeholder cares about the most – I’ll come back to this.

On our Ensenada trip – the “resultant” data is what happened on the trip itself:

  • The midnight swim in in various states of dress
  • Fish tacos and Coronas after 6 hours of surfing, when [Slacker Friend] passed out next to the fire after telling everyone all day how he would rage into the night and through to the next day
  • Watching the full moon rise as you’re falling asleep under the stars
  • Waking up with ocean dew on your face, slamming some Crunch Bombs, and heading out for Dawn Patrol with your friends
  • Hanging with your best friends and knowing that you’re in college and this kind of freedom won’t last forever

This type of data revolves around the experience – the stories you tell afterword, the pictures you might share, the things you see, etc. Pulled together these things create the “value” of the whole enterprise – it’s Why You Did It In The First Place. This type of data is what the business guys are after and what they care about the most.

Put The Data Where It Belongs
The two kinds of data I’m talking about here sort of have their own needs in terms of storage, which you can probably guess:

    1. The Ensenada Domain Model belongs in something that can support an OO structure the best
    2. The Ensenada Experience Data belongs in something that can support a lot of data and build interesting stories (aka “queries”), with a great degree of fidelity.

In short: put the domain stuff in an OODB, put the “result” stuff in a relational (or OLAP) system.

Some Real World Examples Please.
Let’s put this in concrete examples, keeping in mind that an OODB and RDBMS can exist together quite happily:

  • Commerce: Products, Categories, Sales/Coupons, Users – these are domain constructs subject to complex relationships. Put em in an OODB. Orders, statistical tracking (such as times viewed, added to basket, etc) etc. are “resultant” data – stick it in an RDBMS.
  • Blog/Forums: Users, Posts – domain data. Comments, Pingbacks, Links, Ratings – resultant data.

These examples are of course very arguable :) and might change based on your needs for an application. The bottom-line premise sort of remains the same:

ORMs can’t hit the 100% Object-Oriented Domain Model for a reason: Object Oriented Design != Relational Design. It just is. It’s time to frame persistence in terms of the design required for the data it’s storing.

Note: I am very aware of that many of the tools out there (NHibernate in particular) can work around a lot of these issues. If you know NHibernate well enough to figure out that you have a problem and how to fix that problem. I say why worry about it? Sure SubSonic is fun and awesome – it’s my baby. I think it would play very well tracking how many Fish Tacos and Crunch Bombs you consumed on your Ensanada trip – so use it to do that!

One thing I hear quite often (and I’ve read a good many posts on OODBs since the Alt.NET podcast) is that people don’t think OODBs are performant (this word brought to you by Jon Galloway). The truth of it is that in most cases they will out perform most RDBMSs – IF you use them properly. The same can be said of an RDBMS . it’s all about proper use of technology.  These things have come a long way and running “deep graph” queries doesn’t cost all that much, as long as you play by the rules of your OODB vendor.

But this brings us back to the overall suggestion here: if you’re running Deep Graph queries on your OODB, chances are you’re not storing your data in the right place! OODB queries should really be quick access of objects for your Domain to function – not deep dives into a User’s order history. That’s for the relational system!

Summary
If you’re offended, freaked out, excited, nonplussed, hung over, or otherwise maxxed out in one way or another after reading through all this – hooray! Crazy Talk is good, usually, for one of two things:

  1. Testing what we believe, and affirming that The Way We’re Doing It is Right For Us
  2. Testing what we believe and offering a Whole New Way To Do Something That Makes Us Feel Better

What do you think? And as always, the more detail you can offer, the better! If you think I don’t know what I’m talking about – you’re most likely correct.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • DotNetKicks
  • del.icio.us
  • Technorati
  • TwitThis
  • Reddit
  • Slashdot