Three Case Studies in (Semi-Formal) System Modeling: Luca Viganò
Three Case Studies in (Semi-Formal) System Modeling: Luca Viganò
Luca Vigan
Dipartimento di Informatica Universit di Verona
Case Studies
1 / 57
Table of contents
Example 1: Class Administration Program Example 2: Simulations Program Example 3: Elevator Control Analysis model validation Conclusions
Case Studies
2 / 57
The context
Requirements analysis and definition System and software design Implementation and unit testing Integration and system testing Operation and maintenance
Goal: Specify the requirements as far as possible, but as abstractly as possible. Modeling languages and methods are used here!
Luca Vigan (Universit di Verona) Case Studies Ingegneria del SW, 13.04.11 3 / 57
Shows integration of diagrams in the modeling process. Disclaimer: 30-minute case studies are (over)simplications!
Luca Vigan (Universit di Verona) Case Studies Ingegneria del SW, 13.04.11 4 / 57
Analysis model
Case Studies
5 / 57
Outline
Example 1: Class Administration Program Example 2: Simulations Program Example 3: Elevator Control Analysis model validation Conclusions
Case Studies
6 / 57
Problem 1 (cont.)
Case Studies
8 / 57
Problem 1 (cont.)
Case Studies
9 / 57
UTO
CS4 Lecturer
CS4 Student
Produce Course Handbook: this Use Case takes place after the syllabus committee has determined the set of available modules and the department head has allocated duties to lecturers. The CS4 course organizer updates the core (module-independent) sections of each course handbook by getting the current text from the system, modifying it, and returning the modied version to the system. The lecturer of each module, similarly, updates the module descriptions by getting the text from the system, updating it, and returning it. The updates can happen in any order. When the updates are complete, the system sends a complete text of the handbook by email to the UTO, who prints it and updates the web pages.
Luca Vigan (Universit di Verona) Case Studies Ingegneria del SW, 13.04.11 10 / 57
Collaborators
DIRECTOR OF STUDIES Responsibilities Collaborators Provide human DoSs interface to the system
Class Diagram
Here is a rst version, which should be rened later.
Lecturer teaches 1 0..* Director of Studies directs 1 0..* Student takes 6 6..*
Module
1..*
Questions: Which of the following statements are consistent with this model?
Not all lecturers teach some CS4 module. Not every DoS is a CS4 lecturer. All students must take an honors course.
Luca Vigan (Universit di Verona) Case Studies Ingegneria del SW, 13.04.11 12 / 57
Dynamic modeling
State-charts: no classes with interesting state transitions. Data modeling plays the largest role in design. Behavior is relatively simple. Activity diagram to model work-ow (e.g. task synchronization and dependencies):
Update core sections Determine modules
Allocate duties
syllabus committee
head of department
Case Studies
13 / 57
Outline
Example 1: Class Administration Program Example 2: Simulations Program Example 3: Elevator Control Analysis model validation Conclusions
Case Studies
14 / 57
Project: Develop an integrated modeling environment to support discrete event simulation. Support the development of simulation models (e.g. a specialized CASE-tool) and their simulation. Based on a process-oriented view of simulation. Simulation should both report on events (system traces) and provide statistical summary information.
Case Studies
15 / 57
Description (cont.)
The behavior of an active entity is determined by a sequence of events to be simulated. At any point in the simulation, an active entity is in one of three states.
1
2 3
Active, where it responds to an event. Only one active entity can be in this state at a time and its event time denes the current simulated time. Blocked, waiting for a request to be satised by a passive entity. Waiting for simulated time to reach this objects next event time.
Simulated events arise as messages either from a scheduler or from a passive entity whose state has changed. Simulated events should send messages to a trace le so that an experimenter can follow the internal behavior of the model.
Case Studies
17 / 57
Description (cont.)
Statistics are collected by updating information about passive entities and other values for which information is needed. Examples of values being monitored and their derived statistics are counts of how many times something occurs and the average value over time of something like a queues length. The conditions under which a model executes are varied to observe how the system would respond. The values varied are read from an external data set, which is set up before the model is run.
Case Studies
18 / 57
create model
<<include>>
run a model
<<include>>
observe behavior
Experimenter
<<extends>>
collect statistics
create model: Developer creates an initial model by interacting with editing functions of the tool. He then creates a dataset and checks the model by following the behavior dened in the run a model Use Case. If there are errors, he modies the model and runs it again. observe behavior: Experimenter selects a model, created earlier (see create model). He selects or creates a dataset which determines conditions such as resources and durations of variable delays. He then follows the behavior in the run a model Use Case and, when the model has run, reads the trace generated.
Luca Vigan (Universit di Verona) Case Studies Ingegneria del SW, 13.04.11 19 / 57
Developer
<<include>>
run a model
<<include>>
observe behavior
Experimenter
collect statistics: Before using the run a model Use Case, the Experimenter sets a ag indicating that statistics should be collected and reported by writing them to a le at the end of the run.
collect statistics
<<extends>>
run a model: This Use Case assumes a model/dataset has been selected. The actor starts the model, which consists of instances of objects used to model and observe the system. Each active entity sets itself to an initial simulated event time and to an initial next simulated event, which it reads from the dataset. Each passive entity reads its initial settings from the same dataset. The entities act out behavior specied by the description of each active entitys life cycle, under the control of the scheduler, which ensures that events occur in the order of their simulated time. Passive entities ensure that constraints are respected. . . .
Luca Vigan (Universit di Verona) Case Studies Ingegneria del SW, 13.04.11 20 / 57
schedules
Resource
Buffer
N.B.: ActiveEntity is abstract since the developer provides a concrete realization (through subclassing). Statistic also abstract, although two instances are provided.
Luca Vigan (Universit di Verona) Case Studies Ingegneria del SW, 13.04.11 21 / 57
Abstract classes
An abstract class is a class that cannot be directly instantiated. Instead, one instantiates an instance of a subclass. One can identify an abstract class by writing its name in italics or by using the label {abstract}. Typically, an abstract class has one or more operations that are abstract. An abstract operation has no implementation; it is pure declaration so that clients can bind to the abstract class.
Case Studies
22 / 57
Case Studies
24 / 57
One begins in the state in event list, i.e. one waits in evList of the Schedulers. A transition occurs when the object receives an act()-message. Upon leaving the state active, the object either terminates or sends itself to the Scheduler in the form of a wait-message. ActiveEntity has a nested state machine named activeDetail, which species specialized details from active. In each specialization of ActiveEntity, the Developer must later dene activeDetail.
Luca Vigan (Universit di Verona) Case Studies Ingegneria del SW, 13.04.11 25 / 57
Case Studies
26 / 57
Outline
Example 1: Class Administration Program Example 2: Simulations Program Example 3: Elevator Control Analysis model validation Conclusions
Case Studies
27 / 57
Each oor, except the rst oor and top oor, has two buttons to request the elevator to go up or down, respectively:
Illuminate when pressed. Cause the elevator to visit the corresponding oor. Illumination is canceled when the elevator visits the oor and then moves in the desired direction.
Case Studies
28 / 57
Case Studies
29 / 57
Case Studies
30 / 57
Case Studies
31 / 57
Case Studies
32 / 57
The project manager decides that the analysis results should also be discussed with the hardware engineer. Engine cannot be told to move to a given oor. Messages understood by the engine:
Start moving in a given direction. Stop moving.
Case Studies
33 / 57
Case Studies
34 / 57
Case Studies
35 / 57
Case Studies
36 / 57
Case Studies
37 / 57
Case Studies
38 / 57
Case Studies
39 / 57
Alice enters elevator on rst oor and pushes button for fth oor. System initiates elevator to move to fth. When elevator is on second oor, Bob pushes hall button on third oor. System stops elevator on third oor. Bob enters elevator and pushes button for sixth oor. System initiates elevator to move to fth oor. System stops elevator on fth oor. Alice gets off. System initiates elevator to move to sixth oor. System stops elevator on sixth oor. Bob gets off.
Case Studies Ingegneria del SW, 13.04.11 40 / 57
4 5 6 7 8 9 10 11
Case Studies
41 / 57
Case Studies
42 / 57
Case Studies
43 / 57
Case Studies
44 / 57
Class diagram
Case Studies
45 / 57
Case Studies
46 / 57
Outline
Example 1: Class Administration Program Example 2: Simulations Program Example 3: Elevator Control Analysis model validation Conclusions
Case Studies
47 / 57
Case Studies
48 / 57
Case Studies
49 / 57
Case Studies
50 / 57
One problem with modeling: we describe a system model with many different views:
Use Cases, class, sequence, and state diagrams.
We need to check the equivalence of these views. Syntactical check of the models.
Consistent naming of classes, attributes, methods. No dangling associations (pointing to nowhere). No double-dened classes. No missing classes (mentioned but not dened). No classes with the same name but different meanings.
Case Studies
51 / 57
Case Studies
52 / 57
Conclusions
Outline
Example 1: Class Administration Program Example 2: Simulations Program Example 3: Elevator Control Analysis model validation Conclusions
Case Studies
53 / 57
Conclusions
Summary
Models yield different views of a system at different levels of abstraction. Models compliment textual documentation. Useful for planning, development, etc. ... Iterating brain-storming/diagrams/discussions is helpful in building models and improving general problem understanding. Building models is a skill that must be acquired through practice! We have not shown any false starts here.
Case Studies
54 / 57
Conclusions
Conclusions
Case Studies
56 / 57
Conclusions
Homework
We continue with the semi-formal analysis of the requirements of our Class Scheduling System software-project and begin the design phase.
1
Rene the coarse state-charts event-model. The new model should in particular contain more rened versions of ROOM _VIEW and CLASS _SCHEDULE _VIEW , and it should yield a coarse model of the GUI (the graphical user-interface). Give a (brief) evaluation of the different semi-formal analysis techniques that we have seen and employed in the previous exercises. Provide, to this end, a suitable classication of the techniques.
Case Studies
57 / 57