Menu

As simple as possible, as complex as necessary

The simplicity and complexity of ORM

11 May 2011

I'm at last getting my feet wet with ColdFusion 9's ORM feature. I had a paddle in the ORM waters a few years back when Reactor was the only option and I used it to build a small app still in use today.

I recall the mild excitement of not having to write any CRUD SQL, but the desperate slowness, in development mode at least, was a constant reminder of all the complex machinery under the hood. A nice experiment with an internal app used by just one person, but I was far from convinced it was time to stop writing SQL.

Since then I've gone deeper into OO and developed my own fairly efficient and familiar techniques for handling persistence, all with plain old SQL. Note the word familiar.

But with CF9 I can no longer ignore the 800lb gorilla that is Hibernate, demanding respect and getting it across the board it seems. Developers dig the simplicity of loading and saving an entire object in just one line of code, but this time round all the potential performance issues have been dealt with by this mature, enterprise-level Java framework.

But then I read a post on John Whish's superb blog which made me question the simplicity apparently on offer. Rather more than a single line involved in practice it seemed.

Undeterred I began working my way through the Adobe ORM docs, but when I got to the page on Defining relationships I very nearly gave up. That's a formidable list of attributes for something that's supposed to simplify your work as a developer!

So is ORM really the wolf of complexity hiding in the sheep's clothing of simplicity? You might conclude so listening to a recent Hanselminutes on Micro-ORMs, in which I learned that StackOverflow have dropped the equivalent .Net standard ORM because there was too much going on, and it simply didn't perform at the level they needed.

In fact, the answer as to whether something is simple or complex will almost always be "it depends". Simplicity is not an absolute value.

"Simplicity is in the mind" is the title of the second chapter of Donald Norman's excellent book Living with Complexity.

What makes something simple or complex? It's not the number of dials or controls or how many features it has: It is whether the person using the device has a good conceptual model of how it operates... Whether something is complicated is in the mind of the beholder

As I persevere with ORM and my familiarity with it grows, so it feels less and less complex. In fact it is just as complex, but my perception is changing the more I learn.

Whether I'll switch to it permanently I'm not yet sure. My current methods are a lot less powerful I'm beginning to realise but they seem adequate and I may end up just "stealing" the ORM features I enjoy.

Comments

  • Formatting comments: See this list of formatting tags you can use in your comments.
  • Want to paste code? Enclose within <pre><code> tags for syntax higlighting and better formatting and if possible use script. If your code includes "self-closing" tags, such as <cfargument>, you must add an explicit closing tag, otherwise it is likely to be mangled by the Disqus parser.
Back to the top