Is EDM the unlearned EJB lesson?

February 10th, 2007

The Enterprise Javabeans 1.0 spec and implementation made history. In fact the whole heavyweight container idea that Sun came up with is something to be studied, to take lessons from it and never allow this kind of error, that led to mass programmers and projects suicide, to take place ever again.

As everything in Java, every 10 lines of java code have to be accompanied by at least a xml files with 30 lines of markup. The heavyweight nature of the application containers made things very difficult to test. I’ve used EJB in a project (my decision) and relied on XDoclet to easy the burden of all configuration and mapping generation.

To make things easier (or bearable) tools and editors were improved. See: the technology was flawed as it was made stupidly complex, so the tools did what a developer could not possibly deal with: the generation of everything that surrounded it to make it actually work (read configuration, remote/non-remote classes, stubs, exceptions).

In response the java community, which is reactive, came with alternatives. The best and most successful one is Spring, followed by Hibernate, that inspired the latest version of the EJB spec and the extinction of heavyweight containers.

Unfortunately Microsoft doesn’t seem to read Computer Science history books. The EDM framework present on the new ADO.Net version is a monster. Your brain can’t stop screaming YAGNI while you read the “our motivation” documents.

But first, the good things

Finally MS has made a move on providing a tool that goes beyond the core data access stuff and in a different direction than DataSets (although they are supported on LINQ statements). This is great and deserves a bow.

They have also tried to achieve what seems to be unique features on their Entity framework, which is the ability to compose an entity as a logical view of n tables.

Now being practical: who needs this? I’ve tried hard, for the past days since I read the documents, to come up with a situation that I said to myself “hey, ORMs are broken as I can’t make an abstraction of an entity based on multiple tables data”.

To use the EDM you’d have to sit and write:

  • a schema definition
  • the entity mapping
  • the code that maps each entity

But wait, guess who is going to generate everything for you? VS.Net.

Quoting the Entity Framework Overview document:

“When the mapping tool is used to create a conceptual to logical mapping, it produces an XML file that can be consumed by the run-time components of the ADO.NET Entity Framework. The appendix includes the XML representation of the mapping shown above in the section 6.2 “Sample mapping represented as XML”. Fortunately, tools will make it unnecessary for the vast majority of users to have to understand or deal with these XML files.”

If you have to rely on tools to use a technology which otherwise you just couldn’t do it, maybe there’s something wrong with it!

Microsoft should hire an YAGNI guy per product. That would be translated into more frequent releases and smaller and practical tools. I dare to say that stock holders will also appreciated it.

But nevertheless, there will be people welcoming EDM without any piece of criticism. Take for instance this thread on

15 Responses to “Is EDM the unlearned EJB lesson?”

Ayende @ Rahien Says:

Complex EDM

Complex EDM

Ayende @ Rahien Says:

Required position at Microsoft: The YAGNI Guy

Required position at Microsoft: The YAGNI Guy

Alex Says:

What is the difference between microsoft’s tool making it unnecessary to understand and write all those XML files And Monorail making is unnecessary to write all those complex nhibernate mapping files?

Also I completely disagree with you on the whole 3 files situation. The 3 files are good.
1) the CSDL file is unburdened with Mapping and allows you to focus on describing entities. This is a GOOD thing. It is nice to have entity meta-data, this is equivalent to reflection, but with the added bonus it can be done without loading assemblies.
2) the MSL file is pure mapping
3) the SSDL describes the data-model

Because of this novel approach you avoid the infamous dual-schema problem. You can change one model independantly of the other.

That it is complex is the price you pay for more power. And I really think ‘you are gonna need it’… you just don’t see it yet.

Have you thought about the future of distributed data? In a distributed environment where you don’t own the data, you are going to be building on ‘quick sand’ if you expect your data model to remain unchanging. The dual schema problem is gonna really bite hard.

Anders Norås Says:
Markus Zywitza Says:

Although I second all of your points, I have a few remarks on this:

There is an example for a multitable mapping in the Entity Framework Overview: The Sales People EntitySet is build from three distinct tables (SalesPerson, Employee and Contact) using Class-Table-Inheritance. I guess that this feature is mainly used for inheritance mapping.

The other point is the link to I don’t see anything interesting about data mapping in this thread. It’s just the usual VS vs. Eclipse bashing (which in turn is just the same old silly Java vs. .NET discussion) *shrug*.

Speaking of XML: What about NHibernate and Windsor? ;-) Serious, sometimes allowing to configure and tweak every little bit of the application outside of source code is the real YAGNI of our time. That’s why I love ActiveRecord… no more mapping files to maintain (and don’t come with nANT: I won’t replace one XML by another XML, just to use comments over attributes…)


hammett Says:


I’m sure you meant ActiveRecord. About the difference: with AR the mapping is generated dynamically as it’s the only input supported by NHibernate. There is no possible comparison here. If ActiveRecord/NHibernate could only be used if you used an editor that abstracted all mappings/file/code generation, otherwise your head would blew, then we could compare both technologies.


NHibernate also supports inheritance, and in a simpler way. About the link to the TSS.Net post, it was just to exemplify the kind of uncritical mentality of some of our fellows programmers. About Windsor Container, compare its configuration with Spring’s. Now, about N/Hibernate, I also do think it’s too much xml, that’s why I started ActiveRecord. ;-)

Anders, great post!

To all:

My point with this blog post was to show that MS is getting far and far away from current trends on software development, which is simplify the best you can, avoid configurations for things that could be inferred, minimize the programing in xml (if you can’t get rid of it at all). That, IMHO, is the distance from the real world enterprise development challenges that led to things like WebForms, and DataSets.

Alex Says:

What about the dual schema comments? Do you see the motivation yet?

hammett Says:

Alex, SoC is always appreciated. But even so, EDM relies heavily on generated code. You’re not supposed to create the entity classes yourself. Isn’t that a “smell”?

Alex Says:

Generated code is a “smell” I suppose. But there are some very interesting innovations in the EDM, that kind of make up for it.

For example the concept of IExtendedDataRecord being the foundation for objects is very interesting for me. This is sort of like a dependency injection framework for data at the conceptual level.

My gut feeling is that overtime it will become possible to use IExtendedDataRecord in your own classes, thereby being able to leverage the EDM without using the generated classes.

However this is probably not something that we will be able to do in the first version.

hammett Says:

Ok Alex, you win. Being the data-mapping expert I know you are, and which clearly I’m not, I’ll give a vote of confidence to EDM, going to reduce me skepticism level and give it a serious try (no bias) when the 1.0 is out.

But it rather be good. ;-)

Anders Norås' Blog Says:

Software Factories – Another Unlearned EJB Lesson

Many software projects experience disappointing productivity. Often productivity problems are inherent

Anders Norås Says:
Mike Says:

How is MS removed from current trends? There are so much .NET developers that MS ca basically determine the trend.

KISM: Keep it simple, Microsoft | sides of march Says:

[...] Microsoft, the company who provided the products and tools for millions of people to build careers off (myself included), has often forgotten that the simple solutions are often the best. In a recent blog post, hammett wrote about Microsoft’s missteps in this area and their focus on YAGNI (You Ain’t Gonna Need It) — at least, where “You” refers to most people. [...]

werutzb Says:


I want to improve my SQL knowledge.
I red really many SQL books and want to
get more about SQL for my occupation as mysql database manager.

What would you recommend?


Leave a Reply