File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes Destroying object in sequence diagram Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Destroying object in sequence diagram" Watch "Destroying object in sequence diagram" New topic
Author

Destroying object in sequence diagram

vu lee
Ranch Hand

Joined: Apr 19, 2005
Posts: 189
My search logic is as following
1. use DAO to query data, create a Transfer Object (TO) named EmployeeTO, and then redirect this TO to a JSP page
2. use DAO to query data again based on the user select on the previous JSP page, create a new EmployeeTO object, and redirect this object to JSP page.

How do I show that the first TO has been destroyed before the second TO is created in the sequenc diagram. Thanks
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Destroying an object is shown by a cross across the lifeline of an object. See figure 4 at http://www.agilemodeling.com/artifacts/sequenceDiagram.htm for exmaple.

Does that help?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
vu lee
Ranch Hand

Joined: Apr 19, 2005
Posts: 189
It does. Thanks Ilja

I am using MagicDraw to draw the sequence diagram. Per my knowledge, the only way I can destroy an object is to send the message of type 'destroy' to the object. In my case, the JSP page uses TO which then be ready for garbage collection. In the reference diagram, I see that an X is used to indicate the object has been destroyed (there is no need to send destroy message to the object). Suppose my current MagicDraw does not support marking an X, how do I represent this in my sequence diagram.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Ah, the joy of UML software.

The only advice I can give you is to use a more low-level tool - a general purpose drawing program like Visio, perhaps UMLet or even pencil and paper or a white board...
Scott Ambler
author
Ranch Hand

Joined: Dec 12, 2003
Posts: 608
Don't worry about it. As I indicate at UML Sequence Diagramming Guidelines the X is largely unneccessary. If you're writing code in Java you don't have control over object destruction due to garbage collection. If you're using a language such as C++ that doesn't have garbage collection then the programmers very likely have a much better understanding of memory management than you do, so the X will be ignored because they'll simply do the right thing.

My advice is to keep your models as simple as possible. You don't need to put in all the details, you just need models which are Good Enough.

- Scott


<a href="http://www-306.ibm.com/software/rational/bios/ambler.html" target="_blank" rel="nofollow">Scott W. Ambler</a><br />Practice Leader Agile Development, IBM Rational<br /> <br />Now available: <a href="http://www.ambysoft.com/books/refactoringDatabases.html" target="_blank" rel="nofollow">Refactoring Databases: Evolutionary Database Design</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Destroying object in sequence diagram
 
Similar Threads
VO issue - Struts question!!
Choosing Between Forward and Redirect
building a search feature in my application, what is the best approach
How do you pass a string from servlet to jsp if jsp is on another server?
jsp:forward and res.sendRedirect()