What is UML?

Methods and techniques of software design as one of the important stages of software development are described in the paper. The method of software design with using of UML with Petri nets for analyzing of dynamic properties of set UML diagrams is described. Authors offer improved method of using of integration of UML diagrams and Petri nets. The offered method was used for designing of software of automated process control system (APCS) of pumping station: designing of use case, class, object diagrams and sequences diagram that was transformed to Petri net with help of formal rules. Some incorrect states that occurred after pumps enabling/disabling by operator were identified by analysis of Petri net. Reachability tree of the system was gotten by analysis of the Petri net (the value of the tree is about 10 6 of nodes). Testing of offered system was showed on example of APCS of pump station.


Purpose
The purpose of this exercise is to give you a fundamental practical experience ofhow to model a system using different UML diagrams; using both pen-and-paper and a simple UML drawing tool.

Tasks
In this exercise you will model both the structure and the behavior of a train ticket booking system (from now on abbreviated just the system).Imagine a system, such as the Swedish railway's (SJ) booking system.Which are the requirements for such a system?How do you model the most important parts?Which user roles are involved?
We will use UML diagrams for sketching the most relevant aspects of such a system.The diagrams that will be used are: Be prepared to answer questions about details in your solution.
Note that modeling is a constructive process which can result in very different diagrams.Hence, there is not one single solution to the tasks.The import thing that will be checked by the assistants is if the diagram is understandable and describes the system in a reasonable way.

Task 1. Get acquainted with Violet UML
In the following exercises we will use a tool called Violet UML for creating different UML diagrams.The tool is mainly intended for educational purposes, and is therefore very easy to learn, though it does have some limitations regarding UML coverage and expressive power.

Task 2. Use case diagram
When starting to model a system from scratch, it is often hard to know where to start.Initially, it is convenient to start with an external view of the system.Hence, the first thing to figure out is which users or roles that interact with the system.In UML terminology, these are called actors, which can be both human beings and other external systems.
In our train ticket system, there can be several different actors.For example, we can define one actor called Customer, which is the actor that wants to book and buy a train ticket.Another potential actor is an external Bank system, with which the train ticket system communicates, for example when a customer buys a ticket using a credit card.
To capture the interaction between the train ticket system and the actors, it is convenient to write down scenarios.A scenario is basically a plain English text that consists of a sequence of steps describing the interaction between one or several actors using the system.A use case consists of one or several scenarios tied together with a single goal for an actor.It is also explicitly specified which actor that initiates the use case.For example, in the train ticket system one can imagine a use case called "Buy ticket on-line", where both the actors customer and bank system are involved.Another possible use case could be "Pickup pre-booked ticket".In this use case only one actor is involved, i.e. the customer when he/she picks up the ticket from a machine at the train station.
Your task is now to create a use case diagram for the bank system.Besides the two actors above (customer and bank system) and the two use cases ("Buy ticket on-line" and "Pickup pre-booked ticket"), you should figure out two more actors and tree more use-cases.One of the new use cases should interact with three of the actors.

Task 3. Content of the use-cases
UML does not specify how a particular use case should be described and it does not exist any standard way of writing them.The most important aspect of modeling using use cases is actually not the use case diagrams, but simply the use case description text itself.
Sometimes, a use case is seen as the same thing as a scenario, i.e. a sequence of steps that describes interaction between actors and the system.In other cases, a use case can be seen to be a set of scenarios; all with the same goal.The latter viewpoint is used in the following exercise.In an approach described by Fowler (2004), one scenario of the use case is selected to be the main success scenario (MSS).This is then given as an ordered list of steps, each describing an interaction between an actor and the system.In the square below, an example of the content of use case "Buy ticket on-line" is given: A second alternative scenario to the MSS is given as en extension.This extension shows the error case of what should happen if the bank system cannot process the transaction.Your task is now to write a use case using the style above, for the use case with the three interactions you defined in the last task.Your use case should contain at least two scenarios, i.e. one MSS and one extension.The use case should approximately consist of 10-20 steps.

Main Success Scenario (MSS):
The customer opens a web-browser and loads the start page of the train ticket booking system.The customer selects date, time, and station where he wishes to departure from.The customer selects the destination station.
The system shows available seats and price information.The customer selects an alternative and clicks ok.The customer fills in an e-mail address.The customer fills in credit card number and validity date.The system displays the purchase order information.The customer confirms the purchase.The system sends a transaction request to the Bank system.The bank system confirms the transaction.The system displays the booking number and confirmation info in the webbrowser.
The system sends a confirmation e-mail to the customer.
Extensions: 11a: The bank system fails to perform the transaction The system displays the failure information.The customer is asked if it wants to proceed.If yes is selected, return to MSS at step 7.

Task 4. Static structure -Class diagram
The use cases helped us to start to think about the functional requirements of the system from an external point view.In this exercises we shall instead design parts of the static structure of the system using a class diagram.
The first thing to do is to identify potential classes.This is not always easy to do at once, so several iterations need to be done during the class design.One possible way of identifying potential classes is to do a so called noun analysis, i.e. to mark all words in a use case which are nouns.A noun is a word that is used to name a person, an animal, a place, a thing or an abstract idea.For example, in the sentence "The customer enters a pin-code", the underlined words are nouns.The marked nouns can then be used as "potential classes" for a class diagram.However, make sure that only relevant nouns are used.
Your task is now to create a UML class diagram for the train ticket system, by first doing a noun analysis of use case "Buy tickets online".Besides the use case, the class diagram should model the following aspects:  The system holds information about a fixed set of train journeys, i.e. a path between stations where the train just makes short stops.E.g. if a train starts in Malmö, makes a stop in Linköping and has Stockholm as final destination, the train journey is Malmö-Stockholm. The model should describe how train journeys, stations, customers, and bookings are related. The customer given in the use case has no member card and makes only a single time purchase of a ticket.Add another customer category, which has a year card subscription, i.e. who has a login account and pays a one year flat rate. Model only the parts that can be seen as parts of the system, e.g.do not include the bank system in your class diagram. The model should typically include between 5 and 10 classes.

Some tips:
 Use only simple class diagram notations, such as generalization, attributes, associations, and multiplicity. Try to focus on the most important aspects of the system.Avoid getting into details. Try to be pragmatic and create a model that you find reasonable. Some nouns do not need to be described as classes and associations, but just as attributes to other classes.E.g. a booking number is important to include in the diagram, but do not need to have a class of its own.

Task 5. Dynamic behavior -Sequence diagram
A UML sequence diagram is a form of interaction diagram that shows how a collection of objects interact with each other.Instead of showing the static structure as in class diagrams, a sequence diagram describes a certain behavior of the system.A sequence diagram captures typically the behavior of a scenario.
In this task, you should model a sequence diagram describing the main success scenario of the "buy ticket online" use case.In contrast to the class diagram, you should now include external actors, such as the customer and the bank system.Furthermore, you should try to include some of the internal classes of the system that you defined in task 4.
The Violet UML editor has some expressiveness limitations when it comes to sequence diagrams.Therefore, this exercise should not be done using your computer, but with ordinary pen and paper.UML is actually very useful when sketching with pen and paper, or during a meeting on a whiteboard.

Some tips:
 Use only simple notations, such as synchronous messages, lifelines with activations and return messages (see lectures). A diagram with 5-7 lifelines is reasonable. Sketch the diagram first on one paper; then draw it more nicely on another piece of paper when you feel that you have a solution. Remember that UML sketching is about showing the most important part of the system, i.e. we should avoid unnecessary details.  If you are unsure of the UML notation, please review the lecture notes about sequence diagrams (lecture 6).
Use case diagram -for capturing functional requirements. Class diagram -model the most important static structure of parts of the system. Sequence diagram -outline the dynamic behavior for one use case.When you have finished all the tasks you should report to the lab assistant and give an oral explanation and a demonstration of what you have done and what you have learned from it.
To start the program, open a UNIX shell and execute the following command: