Search code examples
umlactivity-diagram

Storing and displaying counted values - Activity Diagram UML


There's simply put rounded rectangles to depict actions and rectangles to depict a class diagram which performs an action.

Now there's this ticket counter that displays and logs the total minutes on your parking ticket (structure is predetermined) when you buy one. Then when emptying the ticket machine it prints the total. Does the counting or anything need to be placed in a rectangle or is it okay to put count total minutes in a rounded rectangle? For example: to save each ticket to the 'total' I have an action diagram saying "store counted minutes in total", before I say "delete minutes" and go back to the start of my diagram (next customer).

So basically what I don't understand is: firstly, counting and storing values can this just be done in a rounded rectangle? and secondly, if the the ticket needs to read "you reserved X minutes on parking number Y". I can't just say print minutes and print parking number right? How do I go about this?

enter image description here


Solution

  • You should stop talking about rounded and straight rectangles. Use Action and Class appropriately. Your diagram shows actions of an activity which is part of some use case (scenario). Now, an activity diagram should explain some activity (or UC scenario) by actions in a certain control flow. That's mainly a business perspective and you use that as basis to talk with the actor to ensure his requirements are understood correctly.

    In a later design phase you use that diagram in order to sketch a class model. You could adorn that AD with designed classes to depict how they are related to the flow control. However, it's not very common to do that. Usually you leave the ADs as they are and start the class design in parallel. What you should do is to create collaborations to link classes and use cases. For a fine grained design you create actions which are call behaviors (that is class operations perform something needed in the course of the activities actions). Alternatively/aditionally you use sequence diagrams to show class collaborations.

    Re. your question in the title: you would not show a counter in an AD since that to much programming detail. However, you could show objects like :Ticket and use flow controls with these.

    P.S. As a side note: you need a Merge for the upgoing control flow loops. Else you will have a lock at Select next... since it expects two tokens and will get only one. Bit of nitpicking since any human could understand what is meant. But from a pure UML view it would be wrong (resp. an automate would not run with that input).