Showing posts with label ORM Smackdown. Show all posts
Showing posts with label ORM Smackdown. Show all posts

Thursday, August 27, 2009

Added IAggregate Implementations to ORM SmackDown

The primary reason for using an ORM is to provide a layer of abstraction from your database.  As with most abstractions in software development, an ORM might be considered a leaky abstraction.

The goal of implementing IAggregate for the different ORMs is to provide insight into how different tasks you perform in your high level language are converted and handled by the ORM.  IAggregate provides two methods that do standard things like get counts or averages.  It then allows us to provide different implementations that demonstrates differences in generated SQL and timings based upon an approach.  Generally ApproachOne is the desired one and ApproachTwo may demonstrate a bad practice.

Here is a simple example of simple query that returns counts in a table via NHibernate: image 

and here is another:
image

Can you spot the difference?  Right next to each other, it is probably fairly obvious however if you are new to programming, or don’t know too much about SQL, you might not realize the problem.

With the latest release of ORM SmackDown we attempt to expose some of the differences through the implementation of IAggregate for the different ORMs.

When running the first query we generate the following SQL:image

As with the second we generate different SQL:
image

It should be fairly obvious which result is desirable.

As this is an on-going research project, that hopefully others will find somewhat educational, please feel free to provide feedback on better implementations for different ORMs.

-ec

Presenting ORM SmackDown at Jacksonville Code Camp and Pasco User Group

I’ll be presenting the current status of my research project ORM SmackDown at the Jacksonville Code Camp this weekend (8/29/2009) and the Pasco County .NET User Group meeting tonight (8/27/200).

If you’re traveling to Jacksonville and coming up early on Friday, let me know, if enough people are coming up early, I’ll hold a small reception Friday night at around 5PM at Residence Inn Jacksonville Baymeadows DM me on twitter @ByteMaster or email me at kevinw@software-logistics.com for more information.

Here’s a taste of what we will be reviewing:

image

Hope to see you all there!

-ec

Tuesday, July 21, 2009

Introducing ORM Smackdown

In an effort to become a better developer over the past few months I’ve created the project ORM Smackdown which can be found on CodePlex.  The idea is to create a reference application that would allow me to compare, contrast and evaluate different ORM’s objectively.  As of today (July 21, 2009), I would claim phase one of this project officially reached Alpha status, just in time for it’s introduction at South West Florida’s .NET User Group meeting. 

Phase One consists of the following ORM’s:

  • ADO.NET – Not really an ORM, but a baseline of how the given functionality works without an ORM
  • Entity Frameworks
  • LightSpeed
  • Linq to SQL
  • Linq to NHibernate
  • LLBLGen
  • NHibernate
  • SubSonic 2.2
  • SubSonic 3.0

Phase One

Features presented in Phase One:

  • Mapping Techniques for each ORM
  • Simple Inheritance
  • Basic CRUD (Create, Read, Update and Delete) functionality
  • Some basic Ad-Hoc Queries
  • Unit Test for CRUD and Ad-Hoc Quires
  • A Win Forms application that connects to SQL Profiler to show the generated SQL.  This application also uses the .NET frameworks StopWatch class to accurately capture timings for using the different ORMs.

To perform a fair and objective comparison I created two interfaces ICrud and IExerciser each of these defined a set of methods to be implemented using the different ORMS.  Then using TDD I implemented the interface for each ORM.  Then using poor-mans dependency injection I created instances of those implementations executed them with the same test runner and application.  The result was a project that demonstrates how each ORM performs the identical tasks.

Phase Two

Phase two will consist of the following features

  • Transactions
  • More advanced Inheritance Techniques
  • Concept of Unit of Work
  • Concurrency
  • Built in validation techniques
  • Scalability

To get the source and find out more about this project please visit projects web site on CodePlex at http://ormsmackdown.codeplex.com. 

If your interested in getting involved, have a better implementation for a particular ORM or have a favorite ORM that we aren’t evaluating, please feel free to drop me a note.

-ec