Ward Bell and I wade into O/R Mapping Issues

Ward Bell from IdeaBlade and I recorded an episode of the ALT.NET Podcast with Mike Moore on Object Relational Mapping.  It’s a two parter, with the first part being a discussion on what we want from O/R Mapping, and the second episode getting into the whole Entity Framework controversy.  I’m obviously ALT.NET to the hilt, but Ward is coming from a different perspective.  Hopefully between the two of us we covered the ground in a balanced way.  From Mike’s announcement, we touched on:

P.S.  I’m absolutely sick of people quoting Ted Neward’s Vietnam post.  Waaa.  Sometimes it’s really hard and you have to roll your own one-off solutions for edge cases — and the edge cases that I remember were caused by some goofy database designs and an arbitrary design decision.  Besides, Neward isn’t saying let’s go write stored procedures.  He’s wanting OODB’s.  So if he can use an historical reference to describe ORM, I’ll use a different one for OODB’s:

 

Next year with an OODB. (think “Next year in Jerusalem“) 

About Jeremy Miller

Jeremy is the Chief Software Architect at Dovetail Software, the coolest ISV in Austin. 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 is the author of the open source StructureMap tool for Dependency Injection with .Net, StoryTeller for supercharged acceptance testing in .Net, and one of the principal developers behind FubuMVC. Jeremy's thoughts on all things software can be found at The Shade Tree Developer at http://codebetter.com/jeremymiller.
This entry was posted in Database and Persistence. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Mike

    Jeremy ,

    I certainly wasn’t implying that you write trivial apps. I think I took your join statement out of context. What you are saying is that you pretty much don’t write any sql at all when using an ORM, correct?

    I still think Ibatis is a great tool, and fulfills the needs of an organization like mine. Also, I believe there are many other developers out there in the same situation (hand rolled sql, stored procedures only, etc.)

  • http://codebetter.com/blogs/jeremy.miller Jeremy D. Miller

    @Mike,

    “Unless you are working with an object database or a very simple DB, I don’t know how you can avoid joins”

    That isn’t even remotely true. I don’t write “joins” in sql *and* I don’t write trivial apps. All of this is possible because any half decent ORM is going to take care of that for you. I can even do searches over hierarchies with an ORM, then let the ORM worry about putting it all together and the sql behind the scenes.

    iBatis is a bit of an odd bird because it’s optimized for hand-rolled sql and legacy databases. Something like NHibernate and a cleaner database eliminates the need for hand crafted joins.

  • Mike

    I am a follower of your writing Jeremy and a big fan, but the join statement also threw me for a loop. Unless you are working with an object database or a very simple DB, I don’t know how you can avoid joins. A semi-legacy DB and fear of any non-hand generated sql at my organization keeps me away from a true ORM………

    Let me qualify my statement by confessing that I am a huge Ibatis guy, and SP’s are required where I work.

  • Bob

    Jeremy,

    I wouldn’t think this is really considered reporting. I would be willing to guess that this is a common scenario in many applications where a user wants to edit something, but would like to perform a search on the repository to find it. Do you know of an example (a link, using nHibernate, to it perhaps) that would show how this would work?

    Thanks.

  • http://codebetter.com/blogs/jeremy.miller Jeremy D. Miller

    @Bob,

    Before I start, I gotta pull out the boilerplate warning that ORM’s are optimized for business logic systems and OLTP. You probably wouldn’t use an ORM for reporting.

    The short answer is that the ORM is writing the joins for me behind the scenes. The ORM query language (Linq) would let me express the query in terms of the object graph

  • Bob

    Jeremy,

    You said in the podcast that you hardly ever write joins. I am curious how you would tackle this situtaion without using a join.

    Tables:
    Circuit
    -CircuitId
    -CircuitName

    CircuitEndPoint
    -CircuitId
    -CircuitEndPointNumber
    -LocationId

    Locations
    -LocationId
    -LocationName
    -StreetAddress
    -City
    -State
    -Zip

    In this example Circuit may have many EndPoints, how would you write a search screen that allows searching by CircuitName and/or LocationName. Which displays in a grid with the following columns: CircuitName, End Point Number Location 1, End Point Number Location 2, etc.. Keep in mind that there may be hundreds of thousands of circuits each with multiple end points.

  • http://codebetter.com/blogs/jeremy.miller Jeremy D. Miller

    Ok Mike, I listened to the podcast and I’m the guilty party, I’m mad at myself then.

  • http://blowmage.com/ Mike Moore

    Correct me if I’m wrong, but I believe it was you who referenced Ted Neward’s Vietnam post…