Thursday, April 05, 2007

Danny Simmons Featured on .NET Rocks

Carl Franklin's and Richard Campbell's .NET Rocks interview with Danny Simmons for Show #226, "Daniel Simmons on ADO.NET Entity Framework" appeared today. The show runs 1:08:00 and the interview with Danny starts at 0:08:20.

Update: 5/16/2007: The transcript for this segment is here. Danny's interview starts at the bottom of page 3.

Danny says at the start of his interview that he's been at the center of the Entity Framework's Object Services layer from its beginning.

Persistence Ignorance Missing in the Entity Framework

Here's an early excerpt that relates to Danny's participation in the "Persistence Ignorance" flare-up during the recent MVP Summit at Redmond:

11:45 Richard Campbell mentioned the "O/RM Smackdown" and that he sat at the back of the Entity Framework session at the recent MVP Summit in Redmond. He described "usual suspects," who were in the center of the room on the right, as the "NHibernate Mafia" (James Kovacs, Scott Bellware, Jeffrey Palermo, Jean-Paul Boodhoo, all NHIbernate believers) in a little cluster hammering Microsoft's ADO.NET folks. Danny was sitting at the left in the front, and popped up a couple of times to answer questions. When the session broke, it took him an hour to get out of the room.

14:30 Danny Simmons: Next day we scheduled a lunch [with the NHibernate Mafia] and just went at it. These folks have the impression that we just don't get their style of working. We don't get what they do within NHibernate and are trying to build "this other product." We gave Jeffrey Palermo our vision for a few releases out, this is what it could be like. Jeffrey said, "Yeah! Perfect! You've got it!" I said, "Now let me tell you why it's not coming out that way in this release."

Comment: I would have enjoyed hearing the "vision" and "why it's not coming out" in the Orcas release.

Jimmy Nilsson and the Disappearing Entity Framework Docs

15:50 Carl Franklin: Jimmy Nilsson blogged about the Entity Framework and all traces of the Microsoft documentation for it suddenly disappeared from the Internet. People kid Jimmy that he "killed the product."

Comment: Go to Jimmy's blog and search for the "Infrastructure and EDM" item of 5/12/2006 and its update to find the alleged culprit. (As far as I can determine, Jimmy's attributes the term "Persistence Ignorance" to Martin Fowler, but I haven't found any evidence of Fowler's use of the term or that Fowler has added it to his Catalog of Patterns of Enterprise Application Architecture or Development of Further Patterns of Enterprise Application Architecture page.)

For more details on the missing EF and EDM documents see my 3/15/2006 ADO.NET 3.0 Entity Framework Ephemera and, for their restoration, ADO.NET 3.0 Entity Framework Docs Redux of 6/19/2006.

Defining the Entity Framework and Distinguishing It from an O/RM Tool

The ADO.NET team avoids categorizing the Entity Framework as an Object/Relational Mapping tool, such as NHibernate and commercial O/RM products, although the Object Services layer maps entities to partial CLR classes and relationships. Danny defines the Entity Framework:

16:45 The idea of the Entity Framework is to create a new data model that's a higher abstraction than the relational model. The goal is to give the business model the same theoretical underpinnings--to give it the long-term legs--of the relational model. It's based on Peter Chen's Entity-Relationship model.

17:50 The Entity Framework makes a real runtime representation of the structure--the model of your data, and the constraints on that, in terms that are much closer to the way your application runs.

18:20 In general, it falls into the O/RM model. But there's a key distinction. We're trying to capture the structure and the relationships and constraints on the data as a separate thing before you get to the point of designing your business objects that have behaviors.

Comment: Don't miss Channel9's Dr. Peter Chen: Entity Relationship Model - Past, Present and Future segment video segment, in which Peter Chen and ADO.NET architect Jose Blakeley participate.

EDM Designer[s] and Their Delivery

The EDM Designer won't be in the Orcas RTM, but Danny says:

26:10 We will ship out of band on the Web more visual tools [for] designing the schemas, and maybe even getting to the point of visually specifying the mapping. Today you have to do that in a declarative format and long term I believe we're going to need a whole variety of [designers].

Comment: It's doubtful if many developers will adopt Orcas's Entity Framework for production apps until an "out of band" drop of the forthcoming EDM Designer proves it can handle modifications to XML schema files that cover 95% or more of developers' requirements.

LINQ to Entities vs. Entity SQL

It's still not clear to most developers when to use LINQ to SQL, the EDM with LINQ to Entities, or the EDM with Entity SQL (eSQL). Danny says the following about EDM with LINQ to Entities or eSQL:

29:30 It's a key concept in LINQ [to Entities] to define an interface to IQueryable and get a handle on that specification instead of the compiler actually compiling it. We do a runtime translation of that query specified into the same query trees and then it runs through all the rest of our stack the same as if you had specified the query any other way.

30:00 EntitySQL is very close to SQL, but it has extensions that understand inheritance and navigating relationships. It is a full-representation query language, so you can compose your queries, you can do joins, you can do very, very rich queries.

30:30 You can either buy into LINQ, which for some solutions makes very great sense, or use the text-based [eSQL] query option.

Comment: Danny didn't compare the Entity Framework and LINQ to SQL. LINQ to SQL connects SQL Server (only) databases directly to table-based objects with no intervening mapping layer. LINQ to SQL supports limited limited inheritance; the rows for base class and subclasses must be contained in a single database table. Unlike the Entity Framework, you can generate an SQL Server database from an entity model you create from scratch. Julie Lerman's LINQ to SQL vs. Entity Framework post provides more detailed distinctions, and check out Kevin Hoffman's early (August 2006) LINQ to Entities vs. LINQ to SQL - What should I use and when? post, which contains a feature-by-feature comparison.

Code Generation in Orcas and Future Versions

The present Entity Framework implementation, including the EDM Wizard, starts with the database schema and works up to the EDM and its Object Services.

43:10 The kind of generation we have now goes up from the database to the model. But a lot of people want to go from the object down and generate the database. If I add a property to an object, I want a script generated to add the field to the table and another script to remove it if I change my mind.

44:45 An interesting designer story is "I'm not trying to generate my code from my model, but I'm writing my code and putting hints in it, so we can generate the model out of the code."

45:25 In Orcas, we're getting some of this direction. Like many of the Visual Studio Designers, "Hey, there's this way you can design the model and then we'll do code generation of partial classes." But you also have the option of writing your classes from scratch, implementing a few interfaces that allow us to be aware of what's going on, and then writing the model by hand.

In a later release, we want to go to the next step, which is to write your classes and you tell us to build the model for you. Either one time or in an incremental fashion because "the truth is in the classes." But we have some customers who say "the truth is in the model," so we want to support them, too.

48:00 If you take the Entity Framework vision farther and farther forward, you eventually say, "Well, why do I need to specify the relational model at all? Why don't I hand my entity model directly to SQL [Server] and say 'Store this and do it fast!'"

Comment: The Orcas March 2007 CTP's EDM Wizard does a reasonable job of generating the XML mapping files and class code from the database up but, unlike LINQ to SQL, won't generate a database (or write CREATE DATABASE/TABLE or ALTER TABLE scripts) from the model.

Entity Framework in Orcas March 2007 CTP and Beta 1

50:40 From the standpoint of the Entity Framework, the March CTP and Beta 1 are almost identical. There's some last bit of features that we're busily working on now that will appear in Beta 2 and the Orcas Release. Search Technorati for "Entity Framework" and you'll find some interesting blog entries.

Comment: Be sure to use the double-quotes when you search for "Entity Framework" or you'll receive 4,000+ hits (90% off-topic) instead of 400+ that I found today.

Update 4/6/2007: Major restructuring and additions. 4/7/2007: Added links, made minor corrections, and fixed typos.

0 comments: