Tony Davis

Simple-Talk Editor
News, views and good brews

Anxiety, Dissent and the Entity Framework

Published Wednesday, August 06, 2008 5:05 PM

There is trouble afoot amongst the MVPs who are specialising in Object-Relational mapping (ORM). When the NHibernate mafia, a.k.a. ALT.NET, released their ADO .NET Entity Framework Vote of No Confidence, many of us despaired. Suddenly, it looked more like ANGST.NET than ALT.NET. As I scanned through the long list of names who had signed the document, my heart sank a little.

 

It's not that it doesn't have some valid points to make; it does (though scarcely enough, some might argue, to justify a "petition"). For example, it quite reasonably points that SubVersion doesn't really work with the Entity Framework, and that 'lazy loading' is better than 'explicit loading' for entity-based applications.

 

The problem is that a lot of this gets lost amongst lurid warnings of "unresolved issues" and "technical misgivings" and the "potential future risk they pose to Microsoft customer projects". By signing the petition, the supporters were not just agreeing to the reasonable points it makes, but also to its alarmist tone in general. The average manager reading the document is likely to conclude that there is a 'bad smell' around ORM wrappers, and avoid them altogether.

 

NHibernate is not a general solution. It is fine for the .NET virtuosos, but it is not ORM for the common man and it does not make itself look any better by casting aspersions on Entity Framework. There is plenty of room for a Microsoft take on the long-standing problem of 'impedance mismatch'. At Simple-Talk, we regard Entity Framework in a positive light because of its logical fit with LINQ and Astoria. It is easy to use, and it bridges the conceptual gap between the relational world and the 'object persistence' brigade. It is true that it is just as easy to commit sins against a large relational database with Entity Framework as it was with the old ADO.NET and recordsets, but at least its use should uncover no new horrors for the database administrator.

 

Microsoft gets a pasting when they develop applications in secrecy, and rightly so. However, the EF has been developed via open discussion and dialog with the developer community, and yet they still get into trouble, presumably because the signatories feel their expertise and opinion are being ignored. And yet ultimately, surely, any project must be allowed to make its own decisions in line with its remit and its place in the wider strategy.

 

Dissent is a natural and healthy part of all development communities. And occasionally this dissent will need to be expressed loudly and possibly with the aid of pointed sticks. But the timing, and tone, is wrong. Angst-ridden heckling isn't the best way to encourage Microsoft to take advice from the user communities, rather than battening down the hatches and slopping out the product when it's 'done'.

 

Cheers,

Tony.

Comments

 

Jason Haley said:

August 7, 2008 9:09 AM
 

BrianTowers said:

The fundamental problem with these kinds of "solutions" is that the object model and the relational model are fundamentally different in a way which precludes a simple/semi-automatic mapping method between them except in the degenerate cases where either the relational side is not really relational (being derived from the object model) or the object side is not really object-oriented (being derived from the relational model). So, the short answer is a plague on both your houses.

Back in the 70's in a publication called "New Musical Express" there was a cartoon strip called "The Lone Groover". One strip has stayed with me, partly because as the years go by I identify more and more with the hero. It features the Lone Groover's first encounter with punks. He is pictured, dressed as a cowboy, leaning up against a bar looking down on a couple of scrawny characters with spikey hair and small bits of metal sticking out of various bits of their faces. His speech bubble says simply "I was wearing a Javanese fish-hook through my foreskin before you were born, laddie".

I remember back in the 80's a product called "The Last One" (http://www.tebbo.com/presshere/html/wf8104.htm) which was going to make computer programmers redundant by allowing computer-illiterate managers to specify programs via flowcharts whereupon "The Last One" would generate the program for you. "The Last One" was so called because it was going to be the last hand-crafted human-written computer program.

A few years later I remember the hype surrounding proveable program development. This was the idea that you somehow fed your requirements into this program and it would generate tests to comprehensively test your program. I don't remember anything useful actually being developed (if it had then testers would be out of a job) rather it was some sort of academic project.

What all of these things have in common is that they try and offer automated solutions to what are very difficult problems. What makes the problems difficult is the same sort of thing which makes the traveling salesman problem difficult, namely that as the problem set grows bigger the solution set increases at a polynomially related rate. In short these "solutions" are essentially useless. In the practical world we don't want an exact solution. We want a solution which is good enough.

When I test a program I don't want to test all possible routes through the program, I want to test the routes which are going to be exercised in real life. If there is a bug in a path which is never going to be exercised then who cares?

In the same way, generating a suitable relational model from a given object model is not something which can usefully be automated. Any such "solution" to a real-world complicated example is likely to be unmaintainably large, complex, unrepresentative and useless. In the real world a relational model has to be capable of being tweaked when the object model changes. That means not having to run some program or process to auto-generate the relational model afresh.

From what I can see the "Vote of No Confidence" paper is more accurately a vote of no confidence in the whole automated ORM process. What is hilarious is that in their rush to express their dismay that basically they weren't consulted they've ended up condemning their own efforts as well.

The EF concentrates too much on the data aspects of ORM and ignores the behavioural aspects? Of course it does. Objects have behaviour as well as state but relational entities have state and relationships, no behaviour. The criticism is valid of the ORM process in general not just the EF.
The EF doesn't handle lazy loading very well? Of course it doesn't. That isn't something which can sensibly be automated. It depends on business rules which are always going to be different for each application. And so on.

Having said all that, I am at the end of the day a contractor and I fully recognize these efforts (NHibernate and the EF) for what they are, namely job-creation schemes. They have tremendous potential to generate massive amounts of (unecessary) work both during initial development and, more crucially (typically 90%+ of the work done on a successful project is done during maintenance) during maintenance. If asked about the use of these tools during my day job I will salve my conscience by expressing the opinion that there are probably better and more efficient, albeit more intensive in terms of intellectual requirements, ways of doing these things but that at the end of the day I am happy to go along with them.
August 7, 2008 4:13 PM
 

WebMister said:

In order to try to make sense of the petition, I have reduced it to plain English, and taken out every sentiment that seemed irrelevant. It was a revelation. For the benefit of anyone else who is struggling with making sense of it, here is my precis.
------------------------------------------------------------------------------------------


We’re experts in entity-based applications. We like the idea that Microsoft will provide a framework for entity architectures, but we are worried about Entity Framework itself.

We want to work with Microsoft on entity architecture applications. We want to see entity-oriented applications succeed on the .NET platform.

We want the Entity Framework to be really good

Microsoft need to get the product out on time

We think Microsoft is right in calling us “the technical community’s best and brightest,” We’re clever, and we want to help.  We have lots of experience with entity-based applications with .NET. too.

ADO .NET Entity Framework in its current state is not good because.
• The Entity Framework has concentrated on  the data storage aspects of entity objects, whereas we think that they should have concentrated on making  it possible for objects to follow business rules and business logic. We think the latter is more important
• We don’t want to have to think about the realities of the manipulating large quantities of data. Surely this can be entirely automated?
• We don’t like shared data models. We like lots of them.
• We think it is a good idea to put  business logic in the entity classes. We hate the idea of business logic being in the database.
• It is difficult to test applications written with EF, independently of the database.
• SubVersion and other merge-based source control doesn’t work easily with applications written with  EF
August 8, 2008 8:26 AM
You need to sign in to comment on this blog

















<August 2008>
SuMoTuWeThFrSa
272829303112
3456789
10111213141516
17181920212223
24252627282930
31123456
Monitor your Database Backups Using Operations Manager
 Thomas LaRock shows just how easy it is for a DBAs to monitor any aspect of the databases in their... Read more...

Verity Stob: Geek of the Week
 Real geeks read Verity Stob. Verity writes her painfully funny invective from a powerful advantage, she... Read more...

SQL Server Index Basics
 Given the fundamental importance of indexes in databases, it always comes as a surprise how often the... Read more...

Managing Exchange 2007 Mailbox Quotas with Windows PowerShell
 The use of PowerShell with Exchange Server 2007 can do a great deal to ease the task of managing... Read more...

Optimizing Exchange Server 2007
 Brien Posey ponders an 'off the cuff' remark that Exchange 2007 runs so well with a default... Read more...