I hope I'm not cluttering up the forum with this, but it took me be surprise to see VOs slammed by someone with Johnson's credentials....
I'd be interested in your remarks. Rod Johnson (Founder of Spring Framework) in "Expert One-on-One J2EE Development without EJB" has the following comments on Value Objects: Quote: Surely, since Java is a rather good OO language, object orientation is a given for J2EE applications? While it should be, in fact many J2EE applications are really EJB or J2EE applications more than OO applications. Many common J2EE practices and patterns sacrifice object orientation too easily. Quote: OO design is more important than specific technologies, such as J2EE. We should try to avoid letting our technology choices, such as J2EE, constrain our ability to use true OO design. (end of quote) Lets consider two examples of how many J2EE applications sacrifice OO: - The use of EJBs with remote interfaces to distribute business objects. Designing an application in terms of distributed business objects with remote interfaces can deliver a fatal blow to OO. Components with remote interfaces must offer interfaces designed to avoid the need for chatty calling for performance reasons, and raise the tricky problem of marshaling input and output parameters in terms of transfer or value objects. There are applications that must offer distributed business objects, but most shouldnt and are much better off staying away from this particular minefield. The use of distributed objects is not unique to EJB: EJB wasnt the first distributed object technology and wont be the last. The reason that this problem is linked to EJB is that distributing components is the one thing that EJB makes easy: arguably, too easy. (end of quote) Quote: Unfortunately, too many J2EE applications fail to enjoy the benefits of OO. Many J2EE patterns are either J2EE-specific versions of true design patterns (which arent technology-specific), or actively non-OO. One common violation of object orientation in J2EE applications is the existence of what I call fake objects: objects in appearance, but which dont exhibit some of the characteristics of objects: identity, state, and behavior. Lets look at some common fake objects and why to avoid them if possible: - Transfer objects, often referred to as Data Transfer Objects (DTOs) or Value Objects. Transfer objects are not true objects because they contain only state, without behavior. Transfer objects are a necessary evil in distributed applications (although theres an argument that this kind of data should really be included in an XML structure rather than Java objects). But if we dont want a distributed architecture, theyre redundant and harmful, creating an unwelcome impedance mismatch between business services and callers. (end of quote) Quote: Entity bean performance is often poor because of the overhead of component handling and method interception, especially when dealing with large result sets. Performance is more likely to be acceptable for heavily cached objects. EJB patterns like Fast Lane Reader and Value Object smell like workarounds for such entity bean deficiencies and cannot be considered true design patterns. (end of quote) Quote: It shouldnt really be necessary to emphasize the importance of object orientation in a book on Java-based middleware. However, we feel that it is, because traditional approaches to J2EE have been anything but object oriented: - They have tolerated and promoted non-objects such as value objects and dumb data holders (as opposed to transparently persisted domain objects). (end of quote) He's long on criticism and short on alternatives. Are his arguments relevant to real systems or do they just conform to an architectural esthetic? What does he mean by "transparently persisted domain objects"? -- Regards, Hasan _________________________________________________________ Reply to the post : http://galaxy.andromda.org/forum/viewtopic.php?p=2605#2605 Posting to http://forum.andromda.org/ is preferred over posting to the mailing list! ------------------------------------------------------- This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual core and dual graphics technology at this free one hour event hosted by HP, AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar _______________________________________________ Andromda-user mailing list Andromda-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/andromda-user