Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SCJEA Study Guide design example

 
Frank Silbermann
Ranch Hand
Posts: 1408
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone explain the interaction and activity diagrams on pp. 174-175 of the Cade/Roberts book?
He shows the user requesting "browse" on the BrowseCatalog.JSP. The Browse Catalog.JSP sends a "browse" message to the CatalogControler. The CatalogController asks the ServiceLocator to "getSearchProcessor". The ServiceLocator creates a SearchProcessor (and presumably returns it to the CatalogController).
The CatalogController says "browse(category) to the new SearchProcessor. The SearchProcessor says "getCategories" to the CatalogDAO (data access object). The CatalogDAO issues a "select" statement to ContentMgmmt, which I presume to be a database. (For some reason, it's icon is a stick figure man. Anyone have any idea why?)
The CatalogDAO then creates a CatalogVO (view object).
So far, so good. I would expect the Catalog DAO then to return this view object to its caller, but that's not what is shown. Instead, the Catalog DAO issues a "catalogVO" command (???) to the SearchProcessor, which in turn issues a "catalogVO command to the CatalogController, which in turn issues a redirect command to the ProductPageJSP. Is this an abuse of notation? Is this the author's way of making explicit the returned values?
Then he has the ProductPageJSP, with no input from the Customer, issuing a "getProducts" command back to the CatalogController, which in turn issues a "catalogVO" command back to the ProductPageJSP!!!
By this time, I'm hopelessly lost. Do I completely misunderstand the use of Interaction Diagrams, or is this book's example really poorly done?
 
Ian B Anderson
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Frank,
I think the key point here is that VO does not stand for View Object but actually stands for Value Object. Have a look at this pattern:
http://java.sun.com/blueprints/patterns/j2ee_patterns/value_object/
Then all should become clear.
Good luck
Ian
 
Frank Silbermann
Ranch Hand
Posts: 1408
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ian, I don't see what my slip in terminology has anything to do it. I understand the Value Object pattern -- it is for an EJB to send a data structure to a client, rather than having the client send many small-grained requests for info back to the EJB tier.
Now, since you say this pattern should make it all become clear to me, then would you please explain to me the meaning of the "catalogVO" messege that the CatalogDAO sends to the SearchProcessor?
And the "catalogVO" command that the SearchProcessor invokes on the CatalogController?
And how the ProductPageJSP invokes the "getProducts" command on the CatalogController without being presented to the Customer?
And why the CatalogController then invokes the "catalogVO" command on the ProductPageJSP?
 
Ian B Anderson
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Frank,
I don't have the Cade book in front of me so this is all from memory.
Firstly the a Value Object does not send any messages to any objects, it is passed around by the other objects and should be thought of as data. The Value Object is not business logic.
The CatalogVO is a list of products. The CatalogVO is constructed by the CatalogDAO querying the datastore (this is used to reduce the number of remote calls).
So for example you said "And why the CatalogController then involves the catalogVO command on the ProductPageJSP". The point here is the CatalogVO is not a command it is data that is passed to the ProductPageJSP by the Controller. My guess is that this page is simply used to display the product/s to the customers.
So the SearchProcessor might construct an SQL query that it passes to the CatalogDAO. The CatalogDAO executes it and returns the ResultSet in the form of a Value Object.
Hope that helps
Ian
 
Frank Silbermann
Ranch Hand
Posts: 1408
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ian, I would much appreciate it if you would take another look at the book (pp. 174-5). I really do understand the value object pattern and how it can or should be used. What I don't understand is what the author is actually doing in his interaction diagram.
He really does seem to be issuing "CatalogVO" as a command/method name, and since a value object is, as you say, merely a data structure, this makes no sense to me whatsovever.
 
Ian B Anderson
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank,
My take on the sequence diagram is that the author is simplying showing the CatalogVO being passed between other objects.
If this is what the author is doing does the sequence diagram make more sense? I think it does.
Ian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic