Best practise - Domain model design
Hello forum,
we're writing an application divided into three sub projects where one of the sub projects will be realized using J2EE and the other two sub projects are stand alone fat client applications realized using Swing. So that's the background...
And now the questions:
After doing some research on J2EE best practise topics I found the TransferObject-Pattern (http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html) which we certainly want to apply to the J2EE sub project and to one of the standalone client applications also. To avoid code duplications I like the "Entity Inherits Transfer Object Strategy" approach outlined in the document referenced above. But why does the entity bean inherit from the transfer object class and not vice versa? In my opinion the tranfer object adds additional functionality (coarse grained getData()-method) to the class and isn't it a design goal in OO languages that the class that extends a base class has more functionality than the base class?
For the standalone application we want to use a similar approach and the first idea is to desgin the entitys and let the TO classes extend these entitys.
When I get it right the basic idea behind all of these design schemes is the "Proxy pattern" but when I design it using the previously mentioned way (Entity <-- EntityTO) I will have a very mighty prox beeing able to execute all operations the base class is able to execute.
Any tips and comments welcome!
Thanks in advance!
Henning

