Tuesday, September 23, 2008

Domain Modeling with Scala

[started writing this in Sep 2008; will post now, though not really a complete thought.]

What I dislike most about implementing a domain model with Hibernate (in Java) is how relationships are not treated as first class elements of the model implementation. Consider how with ER diagrams, the concept of a relationship holds the same importance as the entities.

The problem is that the developer must write all of the relationship maintenance code, which is especially cumbersome and error-pone for bidirectional relationships (short circuiting infinite mutual recursive calls; add and remove methods; etc.).

I'm wondering if there might be some way of using Scala traits to mix-in a bidir relationship to the two connected entity classses...

No comments: