Meaningless Drivel is fun!*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes how to show private methods of session beans on 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 » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "how to show private methods of session beans on sequence diagram?" Watch "how to show private methods of session beans on sequence diagram?" New topic
Author

how to show private methods of session beans on sequence diagram?

mimi mang
Ranch Hand

Joined: Dec 02, 2009
Posts: 36
Hello everyone,

I want to show a private method of a stateless session bean on the sequence diagram to make it more readable. But should I show bean interface object on the diagram or the bean object itself on the diagram?

From the caller perspective, it should only know the interface other than the implementation bean. So interface object should be on the diagram. Then how can I show the methods in the bean other than the local or remote interface?

Any ideas is appreciated!

Happy New Year!
Rahul Mishra
Ranch Hand

Joined: Jan 22, 2006
Posts: 211
In my real world experience, private methods are not worth showing in sequence diagrams because it is too much detail for a design..leave this as implementation choice for developers..the choice to have a private method or multiple private methods is better left for the implementation phase of the project..where it can be influenced by factors like reuse..

...this is exactly the reason why you find showing a private method on the sequence diagram tricky (and messy)..

While it is theoretically possible to depict a private method in a sequence diagram..i believe it will confuse the reader/examiner of the sequence diagram..

Let me know if my reasoning changes your mind..


OCMJEA/SCEA, SCDJWS, SCBCD 1.3, SCJP 1.4
My SCEA experience:http://javalogue.blogspot.com/
mimi mang
Ranch Hand

Joined: Dec 02, 2009
Posts: 36
Thanks Rahul, I understand what you meant. The problem here is the specific sequence diagram requirement. For example, If the use case is withdraw money from bank account, your sequence diagram doesn't need to show how the EJB bean be located by ServiceLocator. While if the use case is how to locate the EJB, then if your sequence diagram just show the caller call ServiceLocator to getEJB, then ServiceLocator return the EJB reference to caller. It's too simple to explain what the ServiceLocator does. In my opinion, we need show the JNDI lookup part. but such lookup just a private method of ServiceLocator. do we need show such private method in order to explain how ServiceLocator find the EJB?

This is just an example. How do you sovle such issue in what level detail about this?

Thanks,

Rahul Mishra
Ranch Hand

Joined: Jan 22, 2006
Posts: 211
If your use case is to locate the EJB, i suggest you get inspired from the Service Locator Pattern UML shown in the JEE design patterns..

Have a look @ http://java.sun.com/blueprints/corej2eepatterns/Patterns/ServiceLocator.html

if you notice, they are showing what you want to show. However, please note that i still believe that in a design such as the one required for the exam, 'looking up the ejb' is not a valid use case to be covered as it too granular and the abstraction is way lower than what i would expect it to have.

Ofcourse , its just my opinion but i think you can look at Mark Cade's guide to see how they have handled such issues. There are a few chapters on SCEA Part 2...and i am sure their style of attempting the assignment will provide further insights and offer a better understanding..
mimi mang
Ranch Hand

Joined: Dec 02, 2009
Posts: 36
Thanks Rahul, ServiceLocator case is just an example to show when its detail needed and when its detail is not needed. Once it is needed, then the private methods have to be shown on the sequence diagram. because the code is same no matter it is needed in the diagram or not. So my point is the private methods could be shown on the sequence diagram.

But the problem I have is such private method is important on diagram, however it is a private method in the implementation class other than the interface class. and how can I put such method on interface object within sequence diagram? Or do I need show the implementation class on the diagram? If so, what if I have 2 and more implementation classes for the same interface?



Thanks!
Rahul Mishra
Ranch Hand

Joined: Jan 22, 2006
Posts: 211
At the expense of misinterpreting you again

I would classify a private method as an implementation level detail which should not make it to the sequence diagram. There is a reason you would have made it private, perhaps because the clients should not see it or because creating the private method was driven by reasons of modularized code,etc.

So, If i had a use case..'buy movies'..my main sequence diagram would have all public methods which would show the high level sequence of movie selection, payment,etc...

if i needed to show the private method (in the real world),i would blow out that part of the diagram (in another diagram) and detail it by showing the implementation class in the blown out part..

Together with the information in the class diagram which links the implementation to the interface, the picture should be clear..dont try to do everything in one diagram.

but in my experience even in the real world the blow out representation to show private methods is hardly required..maybe some test takers can comment on what do they do for the exam..also realize that you are just adding to your volume of work..and providing a level of detail which is really not required




mimi mang
Ranch Hand

Joined: Dec 02, 2009
Posts: 36
Thanks a lot Rahul. Your point is so helpful.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to show private methods of session beans on sequence diagram?
 
Similar Threads
Passed Part II/III - 86%
For the PartII question
Representation of SessionBeans in UML Sequence Diagrams
Query about Part II
The tricky stuff of the class diagram in Mark Cade's case study