First time here? You are looking at the most recent posts. You may also want to check out older archives or the tag cloud. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS. Thank you for visiting! (hide this)

In a World of constantly changing requirements adding a new field to a table is pretty common task: a new user profile field, a new flag to control the display of something, some other customization parameter.

Let's see the steps involved in this easy task, both using an ORM (I'm using NHibernate) and using an hand made DAL.

Task NH HandCoded
Add field to the table 1 min 1 min
Update DB script file with the new field 1 min 1 min
Add property to Object (DTO) 1 min 1 min
Add rule to NH mapping file 1 min -
Find and change Insert and Update SPs - 2 min
Find and change all select SPs that return that table - 2 to 10 min
Update the SPs script - 2 to 5 min
Change the CRUD methods of the DAL - 15 min
Fix the misspellings of the SPs parameters or table fields - 5 min
Time spent complaining about having to add a new field and how boring and repetitive the task is - 15 min


4 min 45 min to 1h

Total time with NHibernate4 minutes (3 if you use the attributes for the mapping).

Total time with an hand coded DAL: 45 minutes to 1 hour (using a well designed DAL, and only 1 database, using for example MS SQL and MySQL will lead to almost twice the time)

I used NHibernate as example, but the same applies to all other ORM and Entity Frameworks, and, at some degrees, also to code generation.

Technorati tags: , , ,
posted on Wednesday, July 18, 2007 12:23 PM

Comments on this entry:

# re: ORM vs HandCoded DAL: Adding a new field to a table

Left by Emanuele Ziglioli at 7/18/2007 1:40 PM

3 minutes with the reverse engineering feature of the Hibernate Tools for Eclipse :-)

# re: ORM vs HandCoded DAL: Adding a new field to a table

Left by Simone at 7/18/2007 2:31 PM

Also by hand, just have to add 1 line in the DB script, one property to a class, and a line in the xml file...

# re: ORM vs HandCoded DAL: Adding a new field to a table

Left by Nic Wise at 7/18/2007 3:06 PM

Oh, I can SO relate to this. :(

# re: ORM vs HandCoded DAL: Adding a new field to a table

Left by Peter O at 7/20/2007 7:32 AM

I really like the category: "Time spent complaining" 15 min.

Sounds like the winning MasterCard commercial series!
I have some of my own, though:
"Time spent wondering if I should advocate Hibernate for my team and if I'd get in trouble if something should go wrong midstream: '30min * 14 days'.

"Time spent understanding all the 'many-to-many' constructs in Hibernate": '3 hours and counting'.

"Time spent trying out iBatis.NET as an answer to the Hibernate's learning curve": '3 hours'

"Time lost by project if something actually goes wrong midstream": '60min *8hours * 20 weeks'

"Time spent being a 'sissy' about this decision": 'priceless'

Comments have been closed on this topic.