Entity Framework vote of no confidence in basic terms

I'm about to use ADO.Net Entity Framework for the first time in a real project, so it's probably a worthwhile effort to look into with what happened last year: vote of no confidence towards the entity framework. The wordings in the letter is highly sophisticated....to the extent that I'm scratching my head wondering what some of that mean. So here is my finding, in a [more] logical order.

Not long after that, Microsoft introduce an advisory council for the next release of ado.net, presumably entity framework 2. The council include names like Eric Evans (famous for DDD) and Martin Fowler (famous for design and architectural patterns)

INORDINATE FOCUS THE DATA ASPECT OF ENTITIES LEADS TO DEGRADED ENTITY ARCHITECTURES

EF only focusing on data and there's no way of attaching behavior to it, which leads to Anemic Domain Model anti-pattern. So if you're using EF as an OR/M, it only cover half of the story.

EXCESS CODE NEEDED TO DEAL WITH LACK OF LAZY LOADING

need to be done explicitly instead of working out what needs to be loaded in a call.

var result = entityFrameworkContext.Book.First().Chapters; //return 0 items 
var result = entityFrameworkContext.Book.Include("Chapters").First().Chapters; //return 4 items //or
var book = entityFrameworkContext.Book.First();
book.Chapters.Load();
var chapters = book.Chapters; // return 4 items

as a result, we start caring about how the persister layer interact with the database at a domain layer. EF team's justification for this was in a large enterprise application you want total control over the loading of the data.

LACK OF PERSISTENCE IGNORANCE CAUSES BUSINESS LOGIC TO BE HARDER TO READ, WRITE, AND MODIFY, CAUSING DEVELOPMENT AND MAINTENANCE COSTS TO INCREASE AT AN EXAGGERATED RATE:

kinda continues the idea from the 2 points mentioned previously. Database are tightly coupled to models within the EF context and data access techniques are leaked on to the domain level.

SHARED, CANONICAL MODEL CONTRADICTS SOFTWARE BEST PRACTICES

I think here the letter talks about more than just Entity Framework but also covers ADO.Net Data Services (Astoria).


Canonical model contain the big picture, but does it still maintain efficiency?

The idea is to provide a single location to 'store' all your different enterprise applications' entity data models. This scenario is comparable to the fact that we often have one massive enterprise database guarded by numerous db admins.

I actually like the idea from a DRY point of view. It is many companies dream to have a central storage of data and business rules.On the other hand, from a Domain Driven Design point of view, it's nearly impossible to have one model that works well for any type of applications.

However, there's nothing that stopping from anyone to build software using EF in silos.

EXCESSIVE MERGE CONFLICTS WITH SOURCE CONTROL IN TEAM ENVIRONMENTS

Pretty self explanatory. This just simply means expect to see alot of Auto Merge failed message, and having forced to do a manual merge with beyond compare when working in a team.

  1. says:

    I have been using the EF in a production project in a limited capacity in order to suitability and most importantly its contribution to making my life easier.

    Then I started doing reading and found the "Vote of no confidence". The signatories to this seem to date back to June 2008. Its May 2009 now and the big question in mind is "Is the vote of no confidence still valid?" and hence I found myself here. So if anyone would like to elaborate please do.

    If I look at the main topics I would probably say , with my limited exposure to EF and absence of an English major, the arguments are all still valid. Can anyone tell me otherwise ?

  2. says:

    @Hans indeed. The vote of no confidence is still relevant on the current release. However, if you have no other option but to use it (open source library isn't allowed in your project policy), you still are better off with it than plain ado.net sqlcommands.

    Have a look at the upcoming release of Entity Framework (EF 4) on VS 2010/.Net 4.0. They seem to have addressed many of the concerns with POCO, Persistence Ignorance and Lazy Loading