开发者

NHibernate - Usefulness

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 p开发者_开发知识库rojects it must be avoided. Also, it makes code harder to change.

Are those statements true?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜