Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can I use fork to present multiple actions within a same method?

 
kevin ou
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

For instance, if I have a method A() and within method A, I will have several methods like A1(),A2()... etc. So my question is, how to present these methods (A1(),A2()) for method A() in the Activity diagram? Should I use fork?
Thanks.

Kevin
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use a self-call (looping line) in a sequence diagram to call a method of an object from another method of the same object.
 
kevin ou
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to present it in the Activity Diagram. Moreover, I need to mention that A1() or A2() methods are not concurrent, they are just in sequence.
 
Sathya Srinivasan
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well,

Sequence diagrams do exactly that - mention methods in sequence. Activity diagrams are typically used to display logic within a class (as a part of state transition - some consider it as an alternate view to state diagrams). I have personally used it to show conversation for use cases.

The fork (techically, the decision box) is used like the 'diamond' in a flowchart, which typically represents an if...then...else situation.

From what you say, I don't think that's what you want to represent.
 
Scott Ambler
author
Ranch Hand
Posts: 608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are several examples of forks presented at http://www.agilemodeling.com/artifacts/activityDiagram.htm .

Simply draw a parallel bar with one arrow entering it and several, one for each line of logic, leaving it. At some other point you should join the logic streams, see http://www.agilemodeling.com/style/activityDiagram.htm for modeling guidelines.

- Scott
 
kevin ou
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all thanks for all the inputs, however as I am concerning, the fork is used to present concurrent threads. In my case, A1(),A2() in method A() are not concurrent. They are all called from A(). So the question is, is it appropriate to use fork for this kind of calling methods?
 
Scott Ambler
author
Ranch Hand
Posts: 608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If they're not concurrent then you shouldn't use forks.

Your next best option is to simply have flows from the invoking activity to the sub-activities. If all activities must end before continuing then have them go into a join.

However, it's beginning to sound as if activity diagrams are not the way to go in this case, that you should consider another diagram (sequence diagrams come to mind).

- Scott
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic