![]() Figure 1 depicts a UML sequence diagram for the Enroll in University use case, taking a system-level approach where the interactions between the actors and the system are shown. This includes web-services as well as business transactions implemented by a variety of technologies such as CICS/COBOL or CORBA-compliant object request brokers (ORBs). ![]() A service is effectively a high-level method, often one that can be invoked by a wide variety of clients. ![]() ![]() One way to think of sequence diagrams, particularly highly detailed diagrams, is as visual object code. Sequence diagrams can be used to explore the logic of a complex operation, function, or procedure. For example, a student enrolls in the university, and then immediately enrolls in three seminars. The logic of a usage scenario may also be a pass through the logic contained in several use cases. It may also be one entire pass through a use case, such as the logic described by the basic course of action or a portion of the basic course of action, plus one or more alternate scenarios. The logic of a usage scenario may be part of a use case, perhaps an alternate course. A usage scenario is a description of a potential way your system is used. Sequence diagrams, along with class diagrams and physical data models are in my opinion the most important design-level models for modern business application development.Sequence diagrams are typically used to model: Other dynamic modeling techniques include activity diagramming, communication diagramming, timing diagramming, and interaction overview diagramming. Sequence diagrams are the most popular UML artifact for dynamic modeling, which focuses on identifying the behavior within your system. But for "simple" exception handling, I think a break is a better way to represent it, then alt.UML Sequence Diagrams: An Agile Introduction UML sequence diagrams model the flow of logic within your system in a visual manner, enabling you both to document and validate your logic, and are commonly used for both analysis and design purposes. ConclusionĪs always, the best method depends on the scenario. This is ofcourse a very simple example, and you can have a lot more interaction in the break interaction operator, like logging or transaction handling. I think it even makes things better, because you can see where a sequence stops when an exception occurs. What I like about this way of displaying exception handling is that it makes the diagram much less cluttered. In this example the exception isn't caught until it enters the UI, in this case the ATM. Using a break interaction operator, it would look something like this: Let's take a look when the situation when something happens, what causes the ATM to decline de withdrawal. When the guard condition is true, the current interaction run is abandoned and the clause in the break interaction operand runs. The break interaction operator is similar to the break mechanism in other programming languages. This looks nice, for a small diagram, but once the diagram starts to grow and you get a lot of nested alt interaction operations, you might start to loose the overview. Using an alt interaction operator, it would look something like this: The else clause of the alternative combined fragment runs when no other option is selected. If there is no guard, the operand always runs when it is selected. However, as for any operand, the selected operand in the alternative structure runs only if the guard condition tests true. Only one of the offered alternatives runs on any pass through the interaction. The server confirms the withdrawal is approved and, the service passes this on to the ATM's UI and the ATM dispenses the money.Īn alternative interaction operator represents the logic equivalent of an if-then-else statement. The customer enters the data, the ATM calls a service, which calls the bank's server. I'll describe both methods using a classical example: withdraw money from an ATM when the balance is too low. They both use interaction operators, alt and break. 1Īfter searching for quite a while on how to model exception handling in a UML Sequence Diagram I found two ways to represent exception handling in a UML Sequence Diagram. There are several proposed notations for exception handling. Some clumsy approaches to model try-catch blocks are by utilizing combined fragments - alt (alternatives) and breaks, while adding stereotypes for reply messages representing thrown exceptions. UML provides neither notation to model exception handling in sequence diagrams nor any reasoning why it is absent.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |