0

How to model logic of complex operations? For example save methods for root entities where state, versions and various atributes should be handled according to some logic. DTOs and entities exist.

I was thinking about sequence diagram, activity diagram, natural language and some abstract code.

I think sequence diagram is not appropriate because it's more likely for modeling of an interaction.

Activity diagram seems to me too clumsy and I don't know where to put instructions like assignments of attributes. It doesn't look right in a note or description of an activity.

Natural language is ambiguous and there is little information in large volume.

Mayby abstract code could be the right choice. Or its combination with natural language. Is there any recommended form? I don't want to write Java code.

ziri
  • 493
  • 7
  • 17
  • 1
    @ziri Check DRAKON. It was made for making complex logic as easy as possible. More about DRAKON in my answer here: http://stackoverflow.com/a/23991000/1601703 – vasili111 Jun 02 '14 at 09:15

1 Answers1

4

If you mean - complex algorithms, they are probably best modelled by activity diagrams. Since UML 2.0 they have actions for practically all kind of operations (including assignements). That's not the problem.

I agree though that in some cases it would maybe better to use some more informal approach. Activity diagrams are very slow to draw and to layout and the added value is questionable (if no automation is used later on). Regarding the statement that they are "clumsy" - you can always overcome this problem by a nice structuring and hierarchical breaking your model in several levels (as single activities can contain whole diagram inside them).

Maybe a mix would do the work - outline the main steps of the algorithm, maybe main decisions, loops, invocations, whatever is importang for you. Later add detailed description of those single activitis: using pseudo-code, natural language or even another embedded diagram (states, activities).

Aleks
  • 4,962
  • 1
  • 22
  • 39
  • very helpful answer @Aleks,thank you.I would like to know how to model assignment using action because I found add structural feature value action in UML Specification but I didn't know how to apply this?any example to use this action, if possible? – Melisa Nov 13 '14 at 13:28