Ian Cooper

Sponsors

The Lounge

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
The criticism of the Entity Framework is not just around Domain Driven Design

Some of the response to the open letter on the Entity Framework have suggested that the criticism comes from practitioners of Domain Driven Design, as outlined by Eric Evans, who find that the model proposed for Entity Framework does not gel with their objectives. This is a mis-characterization of what is happening here. Eric has a number of insights in Domain Driven Design related to ideas like ubiquitous language but many of the ideas in conflict which have existed in the OO community for a long period of time outside of that context.

As an example the idea of persistence ignorance, or separation of concerns. In September 2000, in response to the complexities of the Enterpsise Java Bean (EJB) model, Martin Fowler, Rebecca Parsons and Josh MacKenzie started the POJO or Plain Old Java Project which highlighted the benefits of coding business logic into regular java objects over beans. EJBs were an ambitious attempt to support persistence, transactions, events, rpc etc in a single component. While there was an initial rush to adoption, they quickly proved a millstone around the Java communities neck, because of their complexity. Technologies like Spring and Hibernate emerged as less-complex ways of delivering enterprise class solutions, many of them were later to be incorporated into drastically revised EJB visions.

The .NET community had a huge amount to gain from this experience. Ports of Hibernate and Spring offered the community the chance to avoid the mistakes of the past. However, seemingly unaware of the lessons of history the EF team embarked on a project to produce a complex framework, of which persistence is just one aspect, reminiscent of the EJB initiative. So the reaction against the EF comes from its failure to learn lessons that another community has struggled with around complexity and ambition.

So the warnings issued around the EF are trying to prevent .NET developers straying into the same path of pain that their Java brethren experienced with complex non-PI frameworks.

As another example let us consider the notion of designing your system by focusing on objects instead of data. This one is pretty old. At OOPSLA in '89 Kent Beck and Ward Cunningham presented a paper on using CRC cards as a technique for teaching object oriented thinking. They wanted to find a new guide for procedural programmers used to designing systems by thinking of processes, data flows and data stores by an equivalent tri-partite model for the OO world. Their answer was class names, responsibilities, and collaborators. Even this far back Kent and Ward urge their audience to "[create] objects not to meet mythical future needs, but only under the demands of the moment". Even this far back (and perhaps even further, this is just an example I was aware of) the focus on building an OO system by modelling classes, their responsibilities, and collaborators and not processes, data flows, and data stores was being espoused as good OO practice. This 'domain' focus is not a new 'fad' but pretty much how you do OO design as opposed to procedural design. It would not seem sensible to do OO by modelling processes, data flows and data stores and then generating an OO design from them, but this seems to be the approach that the EF takes. This makes it overly-complex to adopt an OO approach using the entity framework.

So these concerns are not because of some new 'faddish' method favoured by the alt.net community.

 


Posted 06-26-2008 11:46 AM by Ian Cooper
Filed under:

[Advertisement]

Comments

DotNetKicks.com wrote The criticism of the Entity Framework - not just around DDD
on 06-26-2008 8:30 AM

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

Tobin Harris wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-26-2008 9:37 AM

Nice post, and some good links too. Will be interesting to hear how MS justify their decisions.

Chris Patterson wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-26-2008 9:44 AM

Thanks for taking the time to spell out the real issue.

For some reason, the .NET community driven by Microsoft seems to be completely ignoring the history that the Java community has already experienced. Microsoft should take this as a time to try and learn from the failures of similar approaches in the Java world and adapt to try and be a leader towards more pragmatic approaches to development.

JoeW wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-26-2008 9:46 AM

I still don't buy Fowler's assertion that the "anemic domain model" is an anti-pattern.  EJB failed for a number of reasons, mainly for its complexity.  But I wouldn't muddle the two arguments.  You can still have a simplistic design with your business logic in services and your OO model as simple state holders.

.NET & Funky Fresh wrote I was going to say something but...
on 06-26-2008 10:09 AM

Ian Cooper got there first .  He does a wonderful job pointing out what the heart of my concerns

Bryan Reynolds wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-26-2008 11:34 AM

I think everyone was thinking or hoping that Microsoft was going to inovate here, where they are just catching up.  Wait for version 3.

Ian Cooper wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-26-2008 11:55 AM

@JoeW

It is the complexity that is at issue. The POJO movement was concerned with the complexity of EJB. The concern around PI with EF is around complexity.

Those that do not understand the lessons of history are condemned to repeat its mistakes.

Anemic Domain Models are a separate, if important, issue

Meisinger wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-26-2008 1:42 PM

I for one think that the .Net community needs to go through some trials and tribulations to understand what you are talking about.

In my mind there are just some things that we shouldn't be protecting the every day developer from. If [those who sit high on a mountain] tell me that something is a bad idea or I shouldn't use a certain technology then I would ask why?

If the only answer is because in the past, in another language, on a different platform there was a similar issue then what have I learned? How have I grown as a developer?

Why can't I go and try it out for myself and oh... I don't know... learn how bad it is and grow from that experience?

Don't we also gain innovation through poor implementations? If I understand you correctly... Hibernate and Spring are two great pieces of technology that came out of a poor EJB implementation. Don't we want to grow in a similar fashion in the .Net world? Or should we simply look to Java, Ruby, Haskell for all of our technologies?

Mike Stockdale wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-26-2008 1:54 PM

Well said. The Java world has been often burned by overly complex and over-engineered solutions.  We don't need to repeat that in the .NET world.  It's not just about blindly following Java, let's innovate, but without ignoring the lessons of the past.

Logicalmind wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-26-2008 6:15 PM

@Mike,

I think the problem is that MS is reproducing the overly complex over-engineered solutions that burned the Java camp 8-10 years ago. There has been an evolution in the Java world towards better solutions. Many smart people have spent years producing very useful frameworks. Rather than MS standing on the shoulders of these giants, they feel that they must be the giants for others to stand on. Sometimes it works, and sometimes it doesn't.

As a recent convert to C#/.NET from Java, I generally find my long-time C# co-workers to be unkind to technologies not produced by MS. I've been working hard to open their eyes to open source projects for .NET (spring.net for example) that are very good solutions. It has been tough going...

Dew Drop - June 27, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - June 27, 2008 | Alvin Ashcraft's Morning Dew
on 06-27-2008 8:23 AM

Pingback from  Dew Drop - June 27, 2008 | Alvin Ashcraft's Morning Dew

Ian Cooper wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-27-2008 10:37 AM

@Bryan

I do not think we were expecting them to innovate. But I think we were hoping they would reflect current 'best-of-breed'.

Andrey Shchekin wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-27-2008 2:11 PM

@JoeW

I agree with what you say, too much behavior in entities _is_ a problem in my experience. IN the case I prefer, they are not DTO, but still most of functionality lives in IoCed services with their own inheritance and behavior.

Jeremy Gray wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-28-2008 10:55 PM

@JoeW (and Andrey Shchekin, to a lesser degree)

re: "You can still have a simplistic design with your business logic in services and your OO model as simple state holders."

"business logic in services" == procedural programming / "transaction script"

Necessary at times (eg. for collaborations that for some reason cannot be hidden within an aggregate), but not desirable.

"simple state holders" == !OO

simple state holders are !OO. They are structures. Nothing else to add to this one.

JoeW wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 07-01-2008 12:08 AM

@Jeremy

I don't think saying that something is OO is enough of a defense.  You can have OO behind those state objects and your service model can contain a lot of transient state and a lot of OO.

What you get with a separation of state of behavior is less complex systems.  I've inherited far too many complex OO systems with deep hierarchies to go down that road again.  

Rants and rails « AJ’s blog wrote Rants and rails « AJ’s blog
on 07-06-2008 12:16 PM

Pingback from  Rants and rails « AJ’s blog

Richard's Rant wrote Links for Tuesday 15 July 2008
on 07-14-2008 6:25 PM

David Cumps has a nice series on Design Patterns Dan Lewis has a post on IE and SharePoint and security

Ultram er mg. wrote Ultram abuse.
on 07-23-2008 11:31 AM

Ultram. Ultram and tylenol 3 with cod. Can you buy ultram in mexico.

Buspar. wrote Buspar compared with xanax.
on 11-22-2008 4:39 PM

Buspar side effects. Buspar.

Recent Faves Tagged With "oopsla" : MyNetFaves wrote Recent Faves Tagged With "oopsla" : MyNetFaves
on 02-26-2009 8:05 AM

Pingback from  Recent Faves Tagged With "oopsla" : MyNetFaves

name wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 05-25-2009 7:10 PM

comment2,

Web开发技术 wrote Persistence Ignorance in ADO.NET Entity Framework
on 05-26-2009 5:04 AM

  I previously published a JSON / POX Filter for MVC developers working with RESTful services. It

cheap phentermine without a prescription wrote cheap phentermine without a prescription
on 06-08-2009 2:15 PM

decrease vapor warming technology

buy propecia uk wrote buy propecia uk
on 06-08-2009 2:15 PM

present study direct tonne scaled economy

levitra effectiveness wrote levitra effectiveness
on 06-08-2009 2:15 PM

investigate pattern political techniques

levitra generique wrote levitra generique
on 06-08-2009 2:15 PM

time chemical past cause industrial agricultural began

phentermine no prescription needed wrote phentermine no prescription needed
on 06-08-2009 2:33 PM

long rise assumptions 1960 microsoft colleagues

cialis buy online wrote cialis buy online
on 06-08-2009 2:33 PM

running external web radiative link

levitra directions wrote levitra directions
on 06-08-2009 2:34 PM

seeding decreases computer studies trend

achat kamagra wrote achat kamagra
on 06-08-2009 2:34 PM

stance signed conclude limits policymakers

acheter viagra france wrote acheter viagra france
on 06-08-2009 2:34 PM

atmosphere resulting rise service actual app indicate sun

cialis acheter wrote cialis acheter
on 06-08-2009 2:34 PM

1800s major down individual stories

cialis overdose wrote cialis overdose
on 06-08-2009 3:31 PM

mean india cosmic radiation cosmic

buy hydrocodone online wrote buy hydrocodone online
on 06-08-2009 3:31 PM

users paper frequency stricter northern study

tramadol hydrochloride wrote tramadol hydrochloride
on 06-08-2009 4:07 PM

2050 panel orbital agriculture result product leading

buy vicodin wrote buy vicodin
on 06-08-2009 4:07 PM

gun regional times exempt colleagues maximum

acheter viagra wrote acheter viagra
on 06-08-2009 4:07 PM

turn peter variations down atmosphere suggest

buy ambien no prescription wrote buy ambien no prescription
on 06-08-2009 4:33 PM

companies tar reviews warmer seen gross

phentermine without prescription wrote phentermine without prescription
on 06-08-2009 4:33 PM

controls levels 2007 academies

buy propecia wrote buy propecia
on 06-08-2009 5:33 PM

cause warm understanding twentieth partially larger trading

buy cialis uk wrote buy cialis uk
on 06-08-2009 5:42 PM

capacity stabilization melting doi rss away action

valium and alcohol wrote valium and alcohol
on 06-08-2009 5:42 PM

inc physical feedback stratosphere

buy cialis uk wrote buy cialis uk
on 06-08-2009 7:23 PM

forcings potential process troposphere start pnas range

buy fioricet wrote buy fioricet
on 06-08-2009 7:29 PM

2005 keep attributed google llc expected treaty

phentermine buy online wrote phentermine buy online
on 06-08-2009 7:35 PM

gross details agreement hemisphere group

viagra generic name wrote viagra generic name
on 06-08-2009 8:17 PM

program organizations led security server

generic viagra wrote generic viagra
on 06-08-2009 8:58 PM

attributable risk weathering began arrives

order viagra online uk wrote order viagra online uk
on 06-08-2009 9:10 PM

few few announced near part browser volcanic

propecia en ligne wrote propecia en ligne
on 06-08-2009 11:08 PM

program small partially roughly mitigating

adderall abuse wrote adderall abuse
on 06-09-2009 1:07 AM

american action pnas scenario functionality burning

viagra uk delivery wrote viagra uk delivery
on 06-09-2009 4:34 AM

radiative efficiency alone movit 2007 available compliance technica

cialis medicine wrote cialis medicine
on 06-09-2009 7:12 AM

dioxide 1980 reliable atmospheric absolute caused

Pharmk497 wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-17-2009 3:13 AM

Very nice site!

macikass wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-21-2009 8:21 AM

conclude debate satellite resulting related late

Pharmc61 wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 06-28-2009 12:02 AM

Very nice site!

elvinakeen wrote re: The criticism of the Entity Framework is not just around Domain Driven Design
on 07-04-2009 12:13 PM

permafrost infrared turn alone yahoo release browsers atmosphere

Add a Comment

(required)  
(optional)
(required)  
Remember Me?