Book a Demo

Author Topic: Activity diagrams, how to?  (Read 7566 times)

Roggan

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Activity diagrams, how to?
« on: December 12, 2004, 03:56:02 am »
Hi,
Im new to UML and having some trouble understanding activities together with swimlanes.

assume the following scenario.

Dice game:
game class
player class
dice class
lamp class


each game has instances of 1 player , 2 dices and 2 lamps (red and green)

game lets player throw dices ,
game calculates sum of dice1 and dice2
if sum = 7 turn green lamp on
else turn red lamp on
end

how would that be modelled in an activity diagram ?
(with swimlanes and object states)


i read in an uml book the other day that by looking on which activities goes in which swimlane , i could create my components interfaces from that.
but i dont see how this would apply here.

so if anyone have the time , please enlighten me :)

//Roger

Kevin Brennan

  • EA User
  • **
  • Posts: 95
  • Karma: +0/-0
    • View Profile
Re: Activity diagrams, how to?
« Reply #1 on: December 13, 2004, 07:39:23 am »
A swimlane shows which class, person etc. is responsible for the event in the activity diagram.

In your case, you should have a swimlane for each class. Then for each action in the activity diagram, indicate which class manages or performs the action.

So throwing the dice is in the player swimlane, the generation of the numbers in the dice swimlane, the total calculated by the game, etc.
Sr. Consultant at blue sands Inc. and Vice President, Body of Knowledge at the IIBA. All opinions are my own.

thomaskilian

  • Guest
Re: Activity diagrams, how to?
« Reply #2 on: December 13, 2004, 08:00:39 am »
Roggan,
additionaly to Kevins statement it has to be mentioned that activity diagrams are usually used as e.g. sub-diagrams for use cases. Here you can graphically show how a certain scenario is executed. In your example you have an actor Player and a use case Play Game. There under you will start (filled bullet) and target your first activity ("throw dice"). Depending on the result you could then fork and go on with the scenario.

You'll notice that activity diagrams are rather independent of your later class model. The balancing act between these is really difficult to explain in few word. You should search the forum for "activity" and/or "use case" to find out more.