问题
I was trying to use the activity diagram to model user interactions with a GUI, and came across the following question: whether to use decision/merge nodes or fork/join nodes in modelling different user choices. For example, a user can either change the settings of the program by clicking a button, or launch a process by clicking another button.
It seemed to me using decision/merge nodes and a control arrow pointing back to the decision node is more natural, as the choices cannot be taken in parallel. But other people seem to prefer fork/join nodes in such cases, e.g. Figure 5. in [1] and Figure 3(b) in [2].
So my questions are:
a) what's the idea behind using fork/join for user choices here? and
b) which combination is more widely accepted in such cases, if there is a preference, and why?
[1] http://www.ibm.com/developerworks/rational/library/4697.html
[2] http://twiki.di.uniroma1.it/pub/Lab_sis_int/PaperEAltroMaterialeDiApprofondimento/PinheirodaSilva_IMKB_2000.pdf
回答1:
You described reaction on user action (events) by GUI. In this example, it is better to use "Event" element in activity diagram. Create activity as a main infinit process executed on GUI layer and add accept event action (Event) for expected actions from user. I mean, add event for "Start Program Setting" , "Launch Proces XY" etc.
来源:https://stackoverflow.com/questions/24641601/use-fork-join-or-decision-merge-nodes-in-an-activity-diagram-for-modelling-user