To (O/R) map or not to map.

The monthly discussion about the benefits and dangers of O/R mapping is making rounds on one of the mailing lists that I am signed up to. One big problem in this space - from my experience of discussing this through with a lot of people over and over – is that O/R mapping is one of those things where the sheer wish for an elegant solution to the data/object schism obscures most of the rational argumentation. If an O/R mapper provides a nice programming or tooling experience, developers (and architects) are often willing to accept performance hits and a less-than-optimal tight coupling to the data model, because they are lured by the aesthetics of the abstraction.

Another argument I keep hearing is that O/R mapping yields a significant productivity boost. However, if that were the case and if using O/R mapping would shorten the average development cost in a departmental development project by – say – a quarter or more, O/R mapping would likely have taken over the world by now. It hasn't. And it's not that the idea is new. It’s been around for well more than a decade.

To me, O/R mapping is one of the unfortunate consequences of trying to apply OOP principles to anything and everything. For "distributed objects", we’re fixing that with the service orientation idea and the consequential constraints when we talk about the network edge of applications. It turns out that the many of the same principles apply to the database edge as well. The list below is just for giving you the idea. I could write a whole article about this and I wish I had the time:

  • Boundaries are explicit => Database access is explicit
  • Services avoid coupling (autonomy) => Database schema and in-process data representation are disjoint and mapped explicitly
  • Share schema not code => Query/Sproc result sets and Sproc inputs form data access schema (aliased result sets provide a degree of separation from phys. schema)

In short, I think the dream of transparent O/R mapping is the same dream that fueled the development of fully transparent distributed objects in the early days of DSOM, CORBA and (D)COM when we all thought that'd just work and were neglecting the related issues of coupling, security, bandwidth, etc.

Meanwhile, we’ve learned the hard way that even though the idea was fantastic, it was rather naïve to apply local development principles to distributed systems. The same goes for database programming. Data is the most important thing in the vast majority of applications. Every class of data items (table) surround special considerations: read-only, read/write, insert-only; update frequency, currency and replicability; access authorization; business relevance; caching strategies; etcetc. 

Proper data management is the key to great architecture. Ignoring this and abstracting data access and data management away just to have a convenient programming model is … problematic.

And in closing: Many of the proponents of O/R mapping that I run into (and that is a generalization and I am not trying to offend anyone – just an observation) are folks who don't know SQL and RDBMS technology in any reasonable depth and/or often have no interest in doing so. It may be worth exploring how tooling can better help the SQL-challenged instead of obscuring all data access deep down in some framework and make all data look like a bunch of local objects. If you have ideas, shoot. Comment section is open for business.

Categories: Architecture | SOA

February 24, 2006
@ 06:59 PM

It was only my second day in out in Redmond and what happens? Doug and I got stuck in an elevator for seven minutes.

Categories: MIX06

The fabulous Ed Pinto has blogged about out breaking changes for the February CTP. Exhaustive list here.

Categories: Indigo

February 22, 2006
@ 05:37 PM

The WinFX Runtime Components February CTP and the SDK and the VS extensions that go with them just hit the download sites. Go get it:

Categories: Avalon | Indigo

I just got a comment from Oran about the lack of durable messaging in WCF and the need for a respective extensibility point. Well... the thing is: Durable messaging is there; use the MSMQ bindings. One of the obvious "problems" with durable messaging that's only based on WS-ReliableMessaging is that that spec (intentionally) does not make any assertions about the behavior of the respective endpoints.

There is no rule saying: "the received message MUST be written do disk". WS-ReliableMessaging is as reliable (and unreliable in case of very long-lasting network failures or an endpoint outright crashing) and plays the same role as TCP. The mapping is actually pretty straightforward like this: WS-Addressing = IP, WS-ReliableMessaging = TCP.

So if you do durable messaging on one end and the other end doesn't do it, the sum of the gained reliability doesn't add up to anything more than it was before. MSMQ is fully in control of both ends of the wire and makes assertions about the endpoint behavior and was therefore the logical choice for our durable messaging strategy in V1, because it already ships with Windows and there is (as of yet) no agreed interoperable set of behavioral assertions for WS-RM around how endpoints must deal with received messages except ACKing them.

See Shy's comments.

Categories: Indigo | MSMQ

February 20, 2006
@ 07:00 PM

Just read this on Robert Hurlbut's blog (via Dominick, source is Doug)

As Doug indicates, the issue here is not "we don't want to do it", but that we need to ship. 

The problem is that partial trust is incredibly hard (and very time consuming) to test for a communication platform that is supposed to have rock solid security (no paradoxon here) and shall perform well. It's just as hard to provide meaningful exceptions (and -messages) in case we'd stumble into a CAS exception. You wouldn't want us to just bubble up some aribtrary security exception, but instead will want us tell you what's causing the problem and how you could fix it. There are (give or take some) 20 base permissions in the framework, most of them allow parameterization, and the system is extensible with custom permissions as well. You can do the math for where that takes you in terms of required combinations and test cases for achieving satisfying test coverage across the whole of Indigo, let alone all the special casing in the actual product code-base.

I wonder how many applications written to support partial trust actually take that complexity into account in their test strategy (hint, hint) ;-)

That said, I will clarify once more that this doesn't mean "we will never do that". It's just not possible to fit this into our V1 schedule in a way that we and you would find the outcome acceptable. 

Categories: Indigo

February 16, 2006
@ 01:00 AM

I am spending my first week at Redmond with the WCF team. All new, all interesting, and a lot to learn.

Amongst the little things I learned is that I'll be speaking at MIX06 with Doug Purdy in a joint session on REST, POX, RSS, AJAX, Web2.0, Media Convergence, and general black magic with WCF/Indigo. That'll be fun. Guess what the demo will be! Yep, right .... shhhh! don't tell anyone. 

Categories: MIX06

Dear MDC Attendees! It was a great pleasure to talk for and directly to so many of you and it was very interesting to learn about the very many interesting projects in which you are using our technologies.

Below you can download my scribbles from the first presentation in HTML format (they are likely “out of context” for everyone not attending the session). The PowerPoint presentations are available at http://windowscommunication.net

MDC2006IntroPresentation.zip (656.95 KB)
Categories: MDC2006

February 4, 2006
@ 10:37 AM

If you have a blog and you post stuff around WCF/Indigo and you think that I don't have you in my aggregator, please post a comment below with your blog URL. And it totally doesn't matter whether you blog in English, Italian, French, Spanish, Dutch, German, Arabic, Chinese, Russian, or any other language ... I want to know.

Categories: Indigo

The picture attached below shows the endpoint architecture of newtellivision. I'd be interested to know whether the "language" I am using there makes any sense to you.

newtellivisionEndpoints.jpg (264.32 KB)

Categories: newtellivision