Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

a question about the value object dp  RSS feed

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
I have a question about the value object design pattern.
I have an entity bean (PlayerBean) and a session bean (LeagueBean), this
session bean acts as a session facade to PlayerBean.
I have created a java class like this:

In the session bean I have the following method :
public void addNewPlayer(PlayerVO pvo) {
}
I have a jsp page that takes some parameters then constructs an instance of
PlayerVO class , then pass this object to a JavaBean component that looks up for the session bean.
have I implements the value object design pattern well ?
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37242
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
The Value Object part looks good. Are you calling the session bean directly from the JSP? It's better to go through a servlet and leave the jsp for presentation only.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This looks reasonable, but I do have one comment.

The term Value Object is no longer used to describe the pattern that you are implementing. As Martin Fowler has pointed out the term Value Object was in use before the Core J2EE Patterns were created and is therefore misleading. The Core J2EE Patterns team has since renamed the pattern to Transfer Object though most of the free world refers to them as Data Transfer Objects. Therefore, I would change the name from PlayerVO to PlayerDTO. Other than that your implementation is fine, though you may want to introduce an Assembler to manage the creation of your DTOs as your design becomes more complex.
[ June 06, 2004: Message edited by: Chris Mathews ]
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
Are you calling the session bean directly from the JSP? It's better to go through a servlet and leave the jsp for presentation only.

Jeanne brings up a good point. Your JSP shouldn't be managing these details itself, it should be used strictly for presentation. In case you don't know, scriptlet code in JSPs is considered an atrocity against Mankind.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually, I have a JavaBean component that looks up for the Session bean.
so, the jsp page declares a java bean like :
<jsp:useBean class="com.Wrapper" scope="session">
<jsp:setProperty ............>
</jsp:useBean>
is there a better approach ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!