Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FormBean[Struts] Vs ValueObject

 
wrushasen dakhane
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please tell me what is the difference between FormBeans in Struts and ValueObject design pattern.

Thanks
Wrushasen
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know very little of Struts however you may want to clarify whether you are referring to the Value Object (P of EAA) pattern, or the Value Object (J2EE) pattern which has been renamed to Transfer Object (J2EE), which is more generally referred to as the Data Transfer Object (P of EAA) pattern.


Value Object (VO) vs. Transfer Object (TO) vs. Data Transfer Object (DTO)
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Upon cursory inspection I would suspect that the motivation behind the design of the Struts Form Bean is different from the motivation behind the Data Transfer Object.

The motivation behind the Data Transfer Object is to create a serializable data container that can help move data across JVM, process and network boundaries. It often carries more data than is required by the caller and is usually devoid of any behavior besides what is necessary to set and get its data members.

A Form Bean can add validation behavior. Being a Java bean means that it has an easily discoverable interface that is easy to configure (and load) declaratively through configuration files (rather than programmatically through program code). It's primary purpose seems to be an abstraction/container for form data, to serve as a parameter to an object modeled after the Command pattern (the Action). The Form Bean is serializable but I'm not sure how essential that is to the primary purpose of the Form Bean - I don't believe that the Action consuming the Form Bean is likely to be in a different JVM from the one where the Form Bean was created in the first place.

It would be incorrect to assume that designs and/or patterns that lead to similar looking implementations "are the same" when in fact the driving motivations are different.
[ March 28, 2007: Message edited by: Peer Reynders ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What Peer said.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic