CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeremy D. Miller -- The Shade Tree Developer

Under the hood and working with .Net, TDD, Software Design, and Agile Stuff

What Dan Simmons forgot to tell you about the Entity Framework

Dan Simmons from the Entity Framework team at Microsoft made a nice post comparing the Entity Framework to other existing tools.  I wanted to pick a little bone with his comparison to NHibernate.  I don't think he said anything inaccurate, and he was very fair minded, but he left out the crucial fact in any consideration of using NHibernate versus the Entity Framework.  The Entity Framework is very intrusive into your application, but NHibernate is not.  NHibernate lets me use POCO's to model the business process in a database agnostic way.  The Entity Framework wants me to bake EF infrastructure directly into my business objects.

The major problem I have with the Entity Framework is very apparent in Dan Simmon's post.  The EF team, and its advocates in the blogosphere, are strictly focused on data.  The last I checked, an application, system, or service usually consists of more than just getting data in and out of a database.  Some of that other stuff is quite challenging as well.  I'd prefer to be able to make that other stuff work in peace without data access infrastructure concerns bleeding into my business classes. 

I would really like to challenge the EF team and the EF cheerleaders to be more cognizant of the entire application architecture instead of focusing strictly on the grubby details of data access. 



Comments

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# May 19, 2008 4:25 PM

Neil Mosafi said:

Oh really?  That sucks hard!  I was under the impression that you could use any object for your entities if you want and the mapping layer would be separate (just like NHibernate or Linq2Sql).  I guess I was mistaken.

It also leaves a sour taste in my mouth to read that lots of new frameworks are going to be built which automatically take advantage of EF (such as Astoria)... why can't those frameworks just use POCOs and leave it up to the developer to plug in persistence providers of their choosing?  Strange decisions

# May 19, 2008 5:14 PM

Scott Bellware said:

Why are we surprised that a team with a data focus has neglected to consider what the term "Entity" means in the business layer, or that the bounded contexts of data and business logic might have necessarily and advantageous differences in the definitions of terms in their dictionaries of terms?

The Entity Framework is more specifically the Data Entity Framework.  It's this distinction that shows clearly and directly that the EF team is out of its element in producing a framework for object oriented application development that makes use of a business data store.

"Entity" means something specific in a database, and is treated a specific way in that context.

"Entity" means something specific in an object-oriented program environment, and is treated a specific way in that context.

An EF "Entity" is an architectural travesty for not recognizing the difference in the contexts and the great advantages to building software with an awareness of the differences.

The EF team's persistence in refusing and recognize these basic application architectural issues raises questions of ethics for me.

In the end, the EF team operates under a safe harbor by shipping a framework that the EF hounds persist in calling an ORM, while simultaneously telling community leaders that the EF is not really an ORM in off-the-record conversations.

The EF team would be able to put themselves right back into the center line of ethics and responsibility to Microsoft customers and customer potential by stating clearly and for the record that the EF isn't really an ORM as they have said in private to insiders.

When we simply get back to seeing the EF as a pretty good query engine, we'll be able to use the tool to achieve the success that it's intended for rather than drag it into architecturally-irresponsible scenarios so as to justify the continued budgeting of the project by trumped up adoption predicated on misrepresentation.

# May 19, 2008 7:10 PM

The Inquisitive Coder » Blog Archive » Entity Framework stuff said:

Pingback from  The Inquisitive Coder  » Blog Archive   » Entity Framework stuff

# May 19, 2008 7:48 PM

Tom Opgenorth said:

I don't think the EF team and EF cheerleaders are the only ones guilty of this narrow focus on  data access.  

It seems that a lot places these days view the application as merely a portal through which to view the application.  Many of the contracts I work on have a mentality of "one screen - one stored proc" and treat the application as just a way to get the stuff from the database to browser (or WinForm app).  

# May 19, 2008 8:20 PM

Eric said:

I like NHibernate but it is somewhat intrusive with respect to the need to make public props/methods virtual in order to do proxys for lazy load.  Certainly, not as severe as DAL inheritence but still annoying.

# May 19, 2008 8:24 PM

Dave Laribee said:

Looks like another Entity Framework barfight! Hell, I'll join the fray started by Jeremy . I feel

# May 19, 2008 8:46 PM

Community Blogs said:

Looks like another Entity Framework barfight! Hell, I'll join the fray started by Jeremy . I feel

# May 19, 2008 10:45 PM

Evan Hoff, Professional Code Junkie said:

I'm going to take a quote from Daniel Simmons on why we should use the Entity Framework . I'm

# May 20, 2008 12:55 AM

Dew Drop - May 20, 2008 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop - May 20, 2008 | Alvin Ashcraft's Morning Dew

# May 20, 2008 12:31 PM

Patrik Löwendahl said:

The question is this, does everybody understand the full strategy behind EDM? And would you rather have Typed DataSets as the Microsoft preferred application model of data?

The EDM and EF are separate things, the EDM is for creating models and the EF is the ORM. The architecture of EDM / EF is layered and separated in such a way that it is possible to build your own ORM above the EDM (or maybe create a NH dialect / provider).

I don't suggest that that's the first thing you should runaway and do, but this clearly shows that the intentions of the EDM is far broader then that of the EF.

A sum-up: www.lowendahl.net/showShout.aspx

# May 20, 2008 1:43 PM

5x1llz said:

cosign the need for awareness of different ways to drive out your architecture....

I personally want to use POCO's and keep them free ( by any means necessary ) of any attributes, properties e.t.c. that are solely related to data persitance. This might work if there was a seperate suite of classes altogether just designated as DTO's.

I thought the whole idea of ORM was to simplify and support OOP principles instead of sending us forwards into the past.

Patrik, thanks for that succint distinction between EDM and EF. It seems EDM will be more useful than EF especially if it allows you to (easily) map to other non-EF ORM providers.

# May 21, 2008 9:34 PM

Wöchentliche Rundablage: ASP.NET MVC, Silverlight 2, C#, Entity Framework, WPF, Javascript | Code-Inside Blog said:

Pingback from  Wöchentliche Rundablage: ASP.NET MVC, Silverlight 2, C#, Entity Framework, WPF, Javascript | Code-Inside Blog

# May 26, 2008 4:30 PM

Weekly Links: ASP.NET MVC, Silverlight 2, C#, Entity Framework, WPF, Javascript | Code-Inside Blog International said:

Pingback from  Weekly Links: ASP.NET MVC, Silverlight 2, C#, Entity Framework, WPF, Javascript | Code-Inside Blog International

# May 26, 2008 4:31 PM

Weekly Links: ASP.NET MVC, Silverlight 2, C#, Entity Framework … said:

Pingback from  Weekly Links: ASP.NET MVC, Silverlight 2, C#, Entity Framework …

# May 26, 2008 6:46 PM

Entity Framework: Our Albatross | Developer Home said:

Pingback from  Entity Framework: Our Albatross | Developer Home

# May 27, 2008 2:01 PM

Entity Framework: Our Albatross | Developer Home said:

Pingback from  Entity Framework: Our Albatross | Developer Home

# May 27, 2008 2:01 PM

EF Long Term Plans | Developer Home said:

Pingback from  EF Long Term Plans | Developer Home

# May 27, 2008 2:02 PM

EricTN said:

You make a great point about there being only a database centric focus.  On the other hand, this is a 1.0 release.  Great feedback and commentary from people like you may have Microsoft broadening the focus and making things more elegant in future releases.  1.0 is 1.0.

# May 28, 2008 11:25 PM

Jeremy D. Miller said:

@EricTN,

Man, I hate to be pessimistic, but the EF team has been getting this feedback for over a year with no announced plans to fix the problems.

# May 28, 2008 11:47 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Jeremy D. Miller

Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy previously worked as a systems architect building mission critical supply chain software for a Fortune 100 company and learned agile development practices as a .Net consultant at ThoughtWorks, one of the pioneers of agile development. Jeremy is the author of the open source StructureMap (http://structuremap.sourceforge.net) tool for Dependency Injection with .Net and the forthcoming StoryTeller (http://storyteller.tigris.org) tool for supercharged FIT testing in .Net. Jeremy's thoughts on just about everything software related can be found on his weblog "The Shade Tree Developer" at http://codebetter.com/blogs/jeremy.miller, part of the popular CodeBetter site. Jeremy is a Microsoft MVP for C#. Check out Devlicio.us!

Our Sponsors

Free Tech Publications

This Blog

Syndication

News

All opinions expressed here constitute my (Jeremy D. Miller's) personal opinion, and do not necessarily represent the opinion of any other organization or person, including (but not limited to) my fellow employees, my employer, its clients or their agents.

About Me

"Best Of" Compendium

StructureMap (Dependency Injection for .Net)

StoryTeller (Supercharged Fit)

Build your own Cab

TestDriven

MVP