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

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") 



Comments

Mike Moore said:

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

# July 10, 2008 6:04 PM

Dew Drop - July 11, 2008 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop - July 11, 2008 | Alvin Ashcraft's Morning Dew

# July 11, 2008 8:54 AM

Jeremy D. Miller said:

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

# July 11, 2008 9:00 AM

Bob said:

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.

# July 11, 2008 12:10 PM

Jeremy D. Miller said:

@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

# July 11, 2008 12:18 PM

Bob said:

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.

# July 11, 2008 2:13 PM

Mike said:

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.

# July 11, 2008 5:23 PM

Jeremy D. Miller said:

@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.  

# July 11, 2008 8:23 PM

Mike said:

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.)

# July 11, 2008 9:01 PM

Jeffrey Palermo (.com) said:

Jeremy Miller was recently on the ALT.NET Podcast discussing O/R Mapping with Ward Bell . Jeremy is one of those guys who is insanely intelligent. I listened to the podcast, and I recommend that you do as well....

# July 13, 2008 2:15 AM

DotNetKicks.com said:

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

# July 15, 2008 4:33 AM

What is tramadol. said:

Tramadol hydrochloride. Buy tramadol. Tramadol.

# August 20, 2008 12:17 PM

Ultracet. said:

Is ultracet addictive. Ultracet dosage and administration. Ultracet and coumadin. Ultracet.

# August 22, 2008 6:28 AM

Lexapro without prescription. said:

How take together wellbutrin lexapro. Half life of lexapro. Lexapro without prescription. Lexapro. Lexapro pills.

# August 25, 2008 10:39 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