tags:

views:

100

answers:

2

I work in a software and hardware development farm. Today one of my colleagues told me that NHibernate is only useful for small projects, and for complex or large scale projects it must be avoided. Also, it makes code harder to change.

Are those statements true?

+6  A: 

Ebay uses Hibernate (the Java version that NHibernate is ported from). I don't consider that a small project.

As far as changing code goes, consider this: Let's assume we need to add a new property to an object.

Here is what has to be done with a hand-rolled data access layer:

  • Add the column to the db table.
  • Change every stored procedure that deals with that object / table. This is usually several stored procedures in my experience.
  • Change the code in the mapping layer
  • Add the property to the Object

Here is what has to be done with NHibernate:

  • Add the column to the db table.
  • Add the property to the HBM file
  • Add the property to the object.
Daniel Auger
Hmm. You are right Daniel. When I heard those from my colleague, I was like thunder-struck. I asked this question here so that I can know if there really is any pitfall or not, and to show these comments to my boss, so that I can prove I am not wrong :)
Night Shade
It's interesting to know Ebay uses Hibernate, but are there any big sites using NHibernate? Or any ORM (excluding SO using linq to sql)
Chris S
I don't know of any specific high profile sites that use NHibernate, but many people in the NHibernate google group (groups.google.com/group/nhusers) are running it on very large projects. As far as high profile site go - Myspace uses iBatis. Also keep in mind that anything built with Ruby on Rails or Django is using an ORM by default.
Daniel Auger
+1  A: 

Have to agree with Daniel Augur on the first point.

On the second, "does it make code harder to change?", I'll provide a general view. Any time you use something ready-rolled you're going to run into restrictions that might not be easier to overcome. Even when the source is available, you may not wish to modify it for fear of deviating to the point of a breaking change.

Part of a software developer's job is determining whether the merits outweigh the drawbacks with 3rd party code.

Paul Alan Taylor
Yup, I totally agree with you, Paul. However, I think, this risk is associated with every third party code. And I think using NHibernate has more merits than drawback for my project :) . Thank you for your answer.
Night Shade