Can outgoing sequence flows after a parallel gateway have conditions? - modeling

I do a university course on business process management. The lecturer said that you can model conditions on sequence flows, which I agree with. However in the context of gateways he said that you can even model conditions on outgoing sequence flows if you use parallel gateways. My understanding is that this is not correct as the bpmn specification/page 97 also states:
A Sequence Flow can optionally define a condition Expression, indicating that the token will be passed down the Sequence Flow only if the Expression evaluates to true. This Expression is typically used when the source of the Sequence Flow is a Gateway or an Activity.
A conditional outgoing Sequence Flow from an Activity MUST be drawn with a mini-diamond marker at the beginning of the connector (as seen in Figure 8.33).
If a conditional Sequence Flow is used from a source Activity, then there MUST be at least one other outgoing Sequence Flow from that Activity.
Conditional outgoing Sequence Flows from a Gateway MUST NOT be drawn with a mini-diamond marker at the beginning of the connector.
A source Gateway MUST NOT be of type Parallel or Event.
From my interpretation the last 2 list items explicitly forbid to model conditions on outgoing sequence flows of a parallel gateway. Am I right or wrong? Or is this more a question of definition and modelling philosophy?
Thank you in advance

I think you are correct with your interpretation of the specification. Here is another source that also states that parallel gateways cannot have conditions.
That being said, in practice you will sometimes find diagrams that violate the standard in a detail. If the diagram is still very clear and understandable, I am personally okay with that - after all, diagrams are meant to be a tool for communication. But you will find other people who would not share this opinion. So yes, asking for the modelling philosophy is also a valid question.
On this concrete example, I do not really see a purpose of having parallel paths with conditions.

Related

Decision in Activity Diagram with multiple Object Flows

I tried to reduce my problem to the following simple example. If the profit is low and the customer is not a regular one then the order should become canceled. In all other cases (low/regular, high/*) the order is to be executed. How should I model the disconnected part in the middle?
Wheter or not the client corresponding to order is a regular client follows from the data model:
I assume you are looking for the formally correct way to model this. Here it is:
If less formality is sufficient, you could skip the decision input flows and simply assume that the guards have access to any objects in the scope of the activity. Then one decision node is sufficient with a guard [profit=low AND not order.customer.regular Customer].

How to represent a complex use case where every step of the main flow can have multiple scenarios (alternative or error path)?

Little background
I'm new to writing use cases and representing their scenarios.
I'm dealing with a complex system. In the first step of analyzing the system, I created a use case diagram where each use case represents a distinct goal or value for the system. I have tried my best to keep the use cases independent. All these use cases require the initialization and activation of the system, so I decided to take out this common part and link it to the main use cases using include relationship.
I understand that include and extend relationships need to be used only when necessary.
Now I'm lookin into defining scenarios for each use case and then developing user stories and requirements based on scenarios.
Main issue
The use cases are very complex and the easiest way to analyze it seems to be mapping it into a sequence of steps/activities where each activity contains several scenarios and each scenario is represented using a sequence diagram.
I understand that an activity cannot be a use case which is related to the main use case using include relationship; but having sequence diagrams for activities seem wrong too.
What is the best way to represent a use case where each step of the main flow is complex and can have several interactions between actors and systems as well as having error scenarios which can result in termination of the sequence at that step or possibility of the user cancelling/aborting the sequence?
I have attached a simplified version of the activity diagram for "Initialize" use case.
As I mentioned, each activity can have many scenarios. For example
"Perform Self check" has many steps and each step might result in a failure that can terminate the sequence and alert the user (via a HMI). The user then can either terminate the initialization or retry.
"Validate system configuration" include steps for obtaining the reference config versions and comparing that to the system config, then download the new config files if necessary and then update the system configs. Each step might have a failure resulting in some sort of message to user and termination of the sequence. In some cases user should be able to skip the failed steps and proceed without doing that activity.
Same goes for every other activity in the diagram; many steps with exception or alternative paths.
Can I map these on one sequence diagram for the "Initialize" Use case?
My attempt to put all these on one sequence diagram failed.
I tried putting all these interactions on an activity diagram with swimlanes but things got so complex that stakeholders have a hard time understanding what is going on.
Maybe I'm trying to put too much details at the system level. Should I leave all these interim steps and interaction for the lower level of design? Should I create a hierarchy of use cases and roll down the complexity? I'm confused. :(
What is the best way to deal with such level of complexity? Could you provide some good examples.
The only way to represent a complex use case, where every step of the main flow can have multiple scenarios, is fortunately very simple:
The complexity of the scenarios does not change anything to the simplicity of the actor's goals. And if the goals are not sufficiently simple, you'd probably looking at too much details. Or the things are not as clear as they should.
The scenarios are often represented with a set of sequence diagrams. But if it gets really complex you'd better show the flow with an activity diagram.
By the way, you do not need to create an artificial extending or included use-case for the sake of modelling common steps. You may just create a separate activity diagram for the common part. Then, in each of your use-case activity diagram, you'd insert a call action of the common activity. This also avoids to misleadingly include the common part in the description of one UC and forget it for the others.
Last but not least, you also want to develop user-stories based on the use-case scenario. This is a mixed approach that requires some more thoughts:
user-stories are generally used without use-cases. Complex erquirements are described as an epic. The epic would then successfully be refine it into user-stories, that fit in an iteration;
it is possible to structure such user-stories according to stakeholder goals and tasks. THis approach is called user-story mapping. This is closer to the use-case, but there is no term to describe the higher-level goals.
use-case driven development is generally used without user-stories: the scenarios and activity directly lead to development without intermeriate user-stories.
Fortunately, the Use-Case 2.0 approach allows to combine both ways. Read the linked whitebook: it's short, it's free, it's written by the inventor of use-cases together with leading authors of use-case methodology; it offers a reegineered appraoch that allows agile developments, using use-case for the big picture and using use-case slices to break it down dynamically into units that can be developped in one iteration.
A complex use case can remain a single use case, but it may need multiple diagrams to specify its flows.
Your activity diagram (although not 100% UML compliant) gives a good overview of the flow of the use case. Keep this as the main diagram. I would decompose the complex steps in separate diagrams. To indicate that a step is decomposed in a separate diagram, you can display a rake symbol, as follows:
See UML 2.5.1 specification, section 16.3.4.1 for more information.

Can Two Flows Go to Same Action in Activity Diagams?

I have two flows going to the same action. The action is Make Payment. One flow is for rent, and other is for purchase. In both cases customer has to pay. I want to use one payment action for both flows. Or should I use merge node and then connect the output to make payment action. I am not sure whether I can use merge node or not, because both flows are independent of each other. I have uploaded a picture.
This one caught me on the wrong foot. When there are multiple unguarded transitions going out of a state/action an implicit fork is issued so multiple tokens leave and travel independently. P. 401:
When an ExecutableNode completes an execution, the control token representing that execution is removed from the ExecutableNode and control tokens are offered on all outgoing ControlFlows of the ExecutableNode. That is, there is an implicit fork of the flow of control from the ExecutableNode to its outgoing ControlFlows.
I seemed to remember that analogously two incoming transitions mean that both have to deliver a token. And reading on (above) on p. 401:
An ExecutableNode shall not execute until all incoming ControlFlows (if any) are offering tokens. That is, there is an implicit join on the incoming Control Flows. Specific kinds of ExecutableNodes may have additional prerequisites that must be satisfied before the node can execute.
Now when you look at p. 425 you find
A merge node is a control node that brings together multiple alternate flows. It is not used to synchronize concurrent flows but to accept one among several alternate flows.
So here you are. You need to merge beforehand to make it correct.
N.B.: If you are modeling informally (so in a certain domain where this is documented) you could live with your notation since it's often used. Theory and practice... It's not recommended, though.
Just to add to Thomas Kilian answer
Can you model like that at all? Yes. But it will mean implicit Join so both flows has to complete in order to start the Make Payment action. This is allowed but not what you want to achieve.
Can you model like this in your case? No. This will have a different behaviour than what you want to achieve (join rather than merge).
Can you use Merge node before the activity to obtain expected results? Yes, that's absolutely correct and preferred way of merging flows when we want to continue when just one incoming flow completes. The fact that the flows are separately triggered does not pose a problem.
Can you achieve the same without Merge node? Yes, you can use parameters and parameter sets. You can use one parameter and the flows coming to that parameter create an implicit merge. Also if you have parameter sets defined action starts when all parameters of just one parameters set is offered a token but that means different sets of parameters are passed with different flows. Yet the approach with parameters is possible only if you have some parameters to pass. Besides it'll more difficult to understand so I would discourage such approach until you really know what you're doing.

How to elaborate information flow in large scale distributed system by UML

I am currently Designing UML Diagrams for a distributed backed made up of 8 nodes, which handle specific operations depending on the message received from the web Client.
The problem I have is that, the initial node which acts as the "Gate of Entry" to all messages and interactions generated from the Client-end, does not contain concrete operations that could be denoted as "Standard Use cases" but only a multitude of message flows pertaining to client-end use cases operations that flow throw this point.
But I also desperately require a method to show a process mapping between the client-end Use Case and initial node Use Case processes for consistency sake. If these messages are not mapped, the following the flow of operations from the Client-end to Server-end will be somewhat complicated.
Unfortunately due to the complexity of the system I have a problem of designing the whole System in a single diagram too.
Some Possible Improvisations considered
• To create "Place holder" like Use Case Ext. notation to indicate an extension.
E.g. The client-end has a place new order Use Case from which a message flows through initial node to the back-end nodes. In order to create connectivity indicate a Use Case which would read Place new order Ext. and this would signify a connectivity but would only point to a message flow.(But I am not sure if this practice is largely excepted in UML.)
• Only rely on Sequence and communication diagrams aim to show how "things" interact, each lifeline designating one of the system components. But I feel is that the correlation between Client-end and Back-end Use Case will not be very clear.
I also checked for similar problems on this forum and there were a few but did not explicitly answer my question.so I thought of posting this question.
Can someone please suggest what would be the best option in showing information flow in this highly event-driven distributed information system such as this - One of the above mentioned or any other options that I may have overlooked?
Have you considered using component diagrams, where the components have ports and the ports accept (and produce) signals instead of operations? A signal is basically a message / event.
You can also model signals as classes at the high level, or in as much detail as you need. You could model some of the properties of an application-level signal such that you can show how a component demultiplexes based on some property before forwarding the message along to an output port.

Differences between DFD (Data Flow Diagram) and activity diagram

I need to know this differences in order to undestand how to use them right.
Which are the differences of DFD and Activity diagram?
Actually, it's reasonably logical. You only have to look at the names.
In data flow diagrams, the lines between "boxes" represent data that flows between components of a system. Because these only show the flow of data, they do not give an indication of sequencing.
In activity diagrams, those lines are simply transitions between activities and do not represent data flow at all. They more represent the sequencing of activities and decisions. You can tell from these what order things happen in.
That's a simplistic explanation but should be a good starting point. Further information can be garnered from Wikipedia for DFDs and activity diagrams.
Explicit bias: I'm a DFDs proponent.
#John is correct that Activity diagrams can be used to represent object flow. #pax equally correct they seldom are.
Two big DFD advantages for me:
Link to object model. Data stores on a DFD provide a really nice way to link the data produced / consumed to the object model. Very useful for consistency and ensuring your thinking is joined up.
They de-emphasise control flow. Far too often designs over-constrain sequencing. Activity diagrams do support concurrency - but it requires the user to (a) remember and (b) use it. So the default is over-serialisation. DFDs don't. They lay bare the real sequence dependencies without any extra effort on the part of the user. Consequently they also make it easier to see causal relationships. If processes a and b both require data input D then it's obvious on the diagram. And hence parallel activity is obvious.
Don't get me wrong - I'm not against Activity diags. Where control flow is the primary consideration I'll use an AD over a DFD. But empirically I'd say I find DFDs a more useful tool in ~70-80% of cases.
Of course, YMMV.
Just a humble opinion from someone who has had to explain processes, both computer and manual, to upper management and CIOs. I have found simple is better and pound-for-pound, DFDs get the message across when I am actually "asked" about details. That being said, the better approach is to always practice the story line and answer in simple answers.
One final comment regarding the age of tools and products. Remember that in most cases these are running the business and work pretty darn good. The adage "you break it (or replace it) and you own it" can make you a hero or make you into a clown.
We have a CIO who wants to replace all mainframe application for the simple reason that they are old technology. One must weigh the consequences and understand if the replacement can handle workload. Have you ever wondered why JPMC, Credit Swiss, Walmart, and Bank of America to name a few still run mainframes?
My apologies for taking it in that direction. Just make sure, whatever analysis tool is used, that all aspects of the replacement are documented including workload, I/O, concurrent users, adoption curve, and scalability.
Data Flow represents flow within one module or one independent code. However Sequence Diagram represents sequence of activity in between different modules.
Yes at some points they may pass the same messages.
I basically use Sequence diagram in interface documents which will be shared with other modules/elements, however DFD will be used in Low level design documents which will be used to develop the code within one module or network element.
If we look closer to a dataflow diagram, we can notice that when a node collects data from all its edges, it starts to process them. And to process, it needs an activity token, which represents access to a processor. Usually the process of obtaining that token is omitted, but it has to exist. Typically, the whole node as a token is put in a double-ended queue, where on the other end of that queue free activities (processors or threads) are stored. A thread pool is a perfect example of such a queue, and the nodes ready to work are represented as tasks. As soon as a node meets activity, they both are taken from the queue and actual processing starts. When processing finishes, activity is returned to the queue. This way we can think of activity as a special kind of token.
So both dataflow and activity diagrams are just simplified variants of a general active-data-flow diagram, with either activities or data tokens omitted. But generally, both kinds of tokens can be represented in a diagram simultaneously.
Programmers used to think about threads as activities, but if we look at them closer, we notice that when a thread is ready to execute, it gets in a line to processors, and real execution starts only when a free processor switch to that thread. This is absolute analogy as tasks are executed on a thread pool. So from simplified point of view, a thread is an activity, and from more rigorous point of view a thread is a data token and the only real activity is a physical processor. This shows that activity tokens are not different from data tokens. And indeed, we can omit the route of node chasing an activity and consider a dataflow node as an activity itself, which starts to work immediately when all its edges (inputs) contain data.

Resources