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

Total:

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: , , ,