Название | Fundamentals of UML. Educational manual |
---|---|
Автор произведения | Sholpan Jomartova |
Жанр | Техническая литература |
Серия | |
Издательство | Техническая литература |
Год выпуска | 2017 |
isbn | 978-601-04-2181-3 |
Figure 18. Actіvіtу Dіagram
Decomposition of operation
Operations can be broken down into sub-activities (subactіvіtіes). Maybe take delivery of the algorithm shown in Figure 18, and define it as a separate activity (Figure 19), and then call it as an operation (Figure 20).
Operations can be implemented as embedded or activity or class methods. Attachments activity can be designated by the symbol «rake». Calling displayed using the syntax «class name :: method name». You can also insert a symbol operation code snippet, if the behavior is not represented by a single method call.
Sections
Activity diagrams tell about what is happening, but do not say anything about who performs any action. In programming, this means that the diagram does not reflect which class is responsible for a particular operation. The modeling of business processes, this means that does not reflect the distribution of responsibilities between the departments of the company. It is not always a problem; it often makes sense to concentrate on what is happening, not on who plays what role in this scenario.
You can split the chart activity in the Forums (partіtіons) that would show who does what, that is, what operations are performing a particular class or division of the company. Figure 21 shows a simple example showing how to order processing operations can be distributed among the various units.
Figure 21 shows a simple one-dimensional partition. The HMD 2 grid can be two-dimensional. Furthermore, each measurement can be taken and split stitch columns, thereby creating a hierarchical structure.
Figure 19. Additional activity diagram
Signals
In the simple example shown in Figure 18 activity diagrams have a well defined start point corresponding to a program or procedure call. Moreover, operations may respond to signals.
Time signal (tіme sіgnal) comes over time. Such signals may mean the end of the month in the reporting period or come every second in real-time controllers.
Figure 22 shows the activity in which the two signals are expected. The signal indicates that the activity receives an event message from an external process. This means that the activity constantly listens to these signals and chart determines how the activity reacts to them.
In the case shown in Figure 22, before the flight is two o'clock (Two hours before flіght), and it is time to collect your luggage. If you pack it ahead of time, then go still will not work until you arrive taxi. If the taxi arrives (Tahі Arrіves) before the luggage is collected (Pack Bags), it must wait.
Perhaps both receive signals and send them. This is useful when a message is sent, and then waits for a response before continuing. Figure 23 shows a good example of this process, based on a common idiom timeouts. In this «race» involved two streams: the first, reached the final state wins and terminates execution of another thread.
Figure 20. Activities from the figure 18 is modified to call the activity of drawing 19
Figure 21. Splitting activity diagrams into sections
Although the units receive signals only expect external event, it is also possible to show it in the incoming stream. This means that listening does not start up until the flow does not initiate reception.
Areas of expansion
When working with the activity diagram, there are occasions when the output of one operation triggers numerous calls another operation. There are several ways to show this, but the best area expansion. Field extensions (ehpansіon regіon) said chart area of activity, where the operations are performed once for each item in the collection.
Figure 24 procedure Choose Topіcs (Choose topic) generates a list of topics. Then, each element of this list becomes a marker for the entrance procedure Wrіte Artіcle (Write article). Similarly, each operation Revіew Artіcle (peer-reviewed articles) generates a single article that is added to the output list field expansion. When all the markers in expanding reach the output collection area expansion generates a unique token for the list, which is transmitted procedure Publіsh Newsletter (Publish a newsletter).
Figure 22. Signals in the activity diagram
Figure 23. Sending and receiving signals
In this case, the input and output collections same number of elements. However, the output may be a collection of elements less than the input; in this case acts as an extension area of the filter.
In Figure 24, all of the articles written and reviewed in parallel, noted that the key word «concurrent». Area expansion can also be iterative. Iterative region should fully process each input element at a time. If there is only one operation, you need to call several times, then use the notation shown in Figure 28. This method of recording involves the expansion of a parallel because it is most common.
Ending the flow
Upon receipt of multiple markers, as is the case with the extension area, the flow stops frequently, even if all the activity is generally not complete. Ending the flow (flow fіnal) marks the completion of a specific stream without completion of the entire activity.
Figure 26 shows a modified version of Figure 25, in which the articles can be rejected. If the article is rejected, then the marker is liquidated ending stream. Unlike the closure of activity, in this case the remaining activity may continue. This approach allows the spreading domain act as filters whereby the output will be less than the input collection.
Figure 24. Area expansion
Figure 25. The notation for a single procedure in the field of expansion
Descriptions associations
By default, the union allows the execution of the output stream when all input flows reach unification. (Or, more formally, it generates a token output stream when coming handles all input flows.) In certain cases, particularly when there is a stream with multiple markers, it is useful to have a more complex rule.
Description of the association (joіn specіfіcatіon) – alogical expression attached to the association. Every time the union comes marker calculated description of association, and if its value is true, then the token is generated. Therefore, the figure of 30, regardless of whether the chosen beverage (Select Drіnk) or throws a coin (Іnsert Coіn), automatic identification of association estimates. Automatic thirst quencher only if made enough money. If, as in this case, we need to show that each input stream received by a marker, it is necessary to refer to streams and included in the description of the association.
Figure 26. End of stream activity
Figure 27. Description association
When used activity diagrams
The biggest advantage of activity diagrams is that they support and encourage the use of parallel processes. Precisely because of this they are a powerful tool for modeling workflows.
You can also use the chart activities as consistent with language UML block diagram. While this allows you to develop a block circuit close to UML, but it is unlikely it is very exciting process. In principle, you can take advantage of the branching and the union, to describe parallel algorithms for concurrent programs.
Often, activity diagrams are used to describe the use case. The danger of this approach is that often the domain experts can hardly follow them. If