Wednesday, March 15, 2006

Together + NHibernate ~= A Great Duo

I just have an opportunity to use Borland Together 2005 for VS.NET. Its LiveSource ? feature is very cool !!!. So, I’m here to tell my experience.
I’m evaluating a modeling tool for modeling business sytem that will be implemented using NHibernate. This system will contains 70-80 classes (a small-medium system). Someone who visited my website may be wonder why I don’t use ECO III. The main reason is because ECO III doesn’t work will with MySQL dbms. The other reason is that ECO III uses the unified approach to maintain object id, so the system may have a number of objects no more that 2^31 (please correct me if I’m wrong). However, this limitation is not a problem for a small to medium system. I calculated that the system can run and work well for at least 50 years. But the problem will occur when there are a lot of transaction per day. Object ids will be run out, and ECO won’t reuse any deleted id.

On the other hand, NHibernate is boring because it cannot fully manage bi-directional associations because it isn’t controlled by a state machine, which ECO has. The main advantages of NHibernate are. 1. ) It allows developer to do o/r mapping at low-level, and 2.) NHibernate objects are plain .NET objects (while ECO objects are not, all ECO business entity implements IObject interface).

I’m evaluating DevExpress XtraGrid for UI layer, it’s amazing control. Not much needed to say. Its databinding ability is extremely cool !!. One problem I encountered for NHibernate with DevExpress and other GUI layer is just we need to implement Equals, ToString, Hash methods for every class. And I’m now ready to by XtraGrid :). FYI, I use ObjectViews to connect NHibernate to XtraGrid instead of ISet, IList or Array.

Back to Together, it is useful for modeling and it makes me wonder that why Together for VS.NET is faster that Together for Delphi (they should be share the same implementation, shouldn’t they.) Code synchronization is beautiful (v. SP1) I am much faster to model the business entity. AFAIK, Together is one of a few tools that allow designer to put some attributes to the design elements (class, method). I think Rational XDE also have this feature, but didn’t try yet. One feature I don’t see in Together is automatic field encapsulation as property, which is needed by NHibernate. May be I just don’t know how to use it (please tell me if you know). Other great features of Together are namespace management, and enum and inner class modeling, which may be useful for one who uses NHibernate. Together also provides very flexible refactoring.