Accuracy of activity diagrams

Hello,

I wonder how deep to detail an activity diagram.
Should I describe all conditions, all possibilities or should I wrap some of them in some general actions ?
I would like to create a first activity diagram that describe a whole use case but not in detail and then describe some of its actions in more accurate activity diagrams. Is it recommended ?

Thank you in advance for any advices.

Regards,

mathmax

Hi Mathmax,

Thanks for your post. The scope depends on the complexity of your problem. If you don;t mind, you can give some details so that we may give some hints.

Best regards,
Lilian Wong

Of course.

The program I’m trying to model aims to spread products of orders into parcels.
A parcel is limited in size and weight, so an order can generate several parcels.
Each product holds size and weight properties and the algorithm will virtually put these products into parcels, trying to group together some of them according to several criteria.

The principle is quite simplified, but here are the main steps:

  • general processing (cancel untreated parcels, sort and filter orders to treat, …)
  • put products in boxes
  • put boxes in parcels

As you can see, there are different level in this algorithm (general processing, orders, parcels, boxes) with a relation 1-n between each of them.

I think I can create one activity diagram for each of these levels. But even with this separation, each diagram will remains quite complex because there is a lot of conditions and special cases.

For example: one of action of the diagram for the general processing could be “cancel all untreated parcels”, but I could also describe which actions should be done to cancel a parcel. I’m not sure it would be very useful because I know how to diagrammatically cancel a parcel and I will program this algorithm myself. But on the other hand, “cancel all untreated parcels” isn’t a simple action but rather a macro containing several actions. An idea would be to create a new “child” activity diagram to accurately describe some similar cases.

Hope this description will give you an idea of the issue I’m confronted with.

Thank you very much for your help.

Best regards,

mathmax

Hi Mathmax,

Thank you for your post. Basically, there are mainly three points to help solving the problem of complexity.

  1. Bear in mind there is abstraction when modeling, that is, you cannot model every little aspect of your system. Sometimes, we need to model as documentation. Sometimes we need to model in a finer level with the use of subdiagram or even a separate model. Sometimes, we just ignore the detail.

  2. You can start from a Use Case Diagram. Use a Use Case Diagram to model your users’ goals’. One goal per use case.
    Ref: 20090409a-ucd (modeling a order packaging system with a UML use case diagram)

Having completed a Use Case Diagram, elaborate the user goals (use cases) into Activity Diagrams.
Ref: 20090409b-elaborating-uc (elaborate a use case into an activity diagram through the use of sub-diagram)

By doing so, separate Activity Diagrams will be produced for different goals. This help reducing complexity from the very high level of modeling.

  1. Now, you can model your activities with Activity Diagram.
    Ref: 20090409c-activity-diagram (model a user goal with sub activity diagram)

Notice the use of Activities. You can see the diagram is rather simple as I didn’t try to model everything within this Activity Diagram. In fact, I am going to further break down those Activities into finer level through the use of Sub-diagram. Therefore, you can imagine that the “Process Order” activity will have one or more (depending to your case) sub-diagrams for representing the finer level details.

===

I also captured two movies to show you how I model an order packaging system with a Use Case diagram:
http://files4.visual-paradigm.com/200904/order-packaging/A-modeling-system-with-use-case-diagram.htm

as well as how to make use of sub diagram to model finer level of details:
http://files4.visual-paradigm.com/200904/order-packaging/B-modeling-top-level-activity-diagram.htm

Yes, I do understand your scenario is much complex than what I have drawn, but as long as you can keep in mind the concept of abstraction, the break down from use case diagram as well as the use of sub diagram, this shouldn’t be a problem to model any complex scenario with UML.

On another note, you probably need to consider to use Sequence Diagram when you need to model how to implement the dynamic behavior of system.

Hope the information has helped. Please feel free to let me know if there are any questions.

Best regards,
Jick


20090409b-elaborating-uc.png

20090409c-activity-diagram.png

20090409a-ucd.png

Thank you very much for your answer. :smiley: This is certainly the more detailed answer I’ve ever got on a forum!
I’ll probably come across new problems when designing theses diagrams, but I think I really have a better idea on how to detail my activity diagrams now.
Thank you for having taken the time to include images and videos; this was very helpful.

Hi Mathmax,

You’re welcome. I hope the material had help. If not, feel free to post again. We will be happy to help you out. :slight_smile:

Best regards,
Jick