Rich Domain Model and Transparent Persistence
I have worked on quite a few enterprise systems built on the J2EE platform in the past few years (some in which I was actively involved in the design and some I worked on other people's design). I have always felt there was something not quite right in almost all of those systems. No matter however hard we tried, we ended up with systems that were not seamlessly object oriented across the various application layers. An evident after effect of this was there were often redundant code and logic duplicated in the various application layers. One obvious example was the myriad of transfer objects that mimicked the underlying entities in terms of state. This caused a huge amount of coupling right from the database through the business layer to the user interface.
I used to think this was an inevitable by-product of distributed systems where it was not such a good idea to transport state and behaviour. However, I soon realised in most but not all of the systems, this was caused by the over-emphasis on use case analysis without significant attention to proper domain modelling. The system was seen as a black box monolith that accepted user requests and produced responses. This led to the design of a bunch of stateless services exchanging dump data between the invoker and the invoked. As a result, domain logic was often duplicated in the various application layers.
Couple of weeks ago, I started on this new project and have had the fortune to work with Rod Johnson (I always wanted to work with him since the first time I met him in a restaurant in Brick Lane three years ago). This project has brought a breath of fresh air into my experience with J2EE. Here we no longer think in terms of dump transfer objects and entity beans. Here we no longer have use cases as the sole design artefact. More than everything, we have a rich reusable domain model built using object-oriented paradigms like inheritance, composition, polymorphism and re-entrancy. And even more important the persistence of the domain layer is transparent using Hibernate. Our object layer doesn't remotely resemble the data layer. I am hugely impressed with Hibernate's persistence capabilities (though there is scope for improvement as any other software; I had some difficulty mapping polymorphic collections).
I think with a proper attach/detach strategy, and transparent data versioning you could have a rich domain layer that can be seamlessly reused in the distributed process spaces of your application. After reading the early draft of EJB 3.0, I understand most of these stuff will be supported by entity EJBs. Anyway, it is a long way to go before the spec becomes final and vendors start supporting it. For the time being, we have some fantastic commercial and open source O/R mappers and JDO implementations, that will move us forward from the "old-school" J2EE of transfer objects and entity beans towards rich domain model and transparent persistence.