Ch5: Software Specification
description
Transcript of Ch5: Software Specification
![Page 1: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/1.jpg)
Ch5: Software Specification
![Page 2: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/2.jpg)
2
Finite State Machines (FSMs)
Consist of:
Use of FSMs:
![Page 3: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/3.jpg)
3
FSMs (contd..)
a a
b
bc
q
q
q
q
1
20
3
Graphically, -
![Page 4: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/4.jpg)
4
FSM example: A lamp
On Off
Push switch
Push switch
![Page 5: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/5.jpg)
5
FSM example: A plant control system
On Off
High-pressure alarm
High-temperature alarm
Restart
![Page 6: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/6.jpg)
6
FSM example: A refinement of plant control system
Pressure signal Temperature signal
Successful recovery
Unsuccessful recovery
OffNormal
Pressure action
OffNormal
Pressure action
Temperature signalTemperature action
Successful recovery
Unsuccessful recovery
Pressure signal
![Page 7: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/7.jpg)
7
Classes of FSMs
Deterministic/non deterministic:
FSMs as recognizers:
FSMs as transducers:
![Page 8: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/8.jpg)
8
FSMs as recognizers
q
q q q q
q q
q
b
e g i
n
e
n
d
0
1 2 3 4
5 6
f
![Page 9: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/9.jpg)
9
FSMs as recognizers (contd..)
q1 q2 q3 q4
q5 q6 q7 q8
qfq0
brr e a
d
h
wr
i
o
te
What are the strings accepted by this FSM?
![Page 10: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/10.jpg)
10
Limitations of FSMs
Finite memory
State explosion
![Page 11: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/11.jpg)
11
Limitations of FSMs (contd..)
Producer
p1
c2
Storage
1
produce
deposit
get
consume
deposit
get get
deposit
p2
Consumer
c1
20
![Page 12: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/12.jpg)
12
Limitations of FSMs (contd..)
In the composite FSM, a state is given by a 3-tuple:
State of the storage:State of the producer:State of the consumer:
Initial state:Total number of states in the composite FSM:
![Page 13: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/13.jpg)
13
Limitations of FSM (contd..)
The resulting FSM
<0, p ,c >
<0, p ,c >
consume
produce
consume
produce
consume
produce
consume
produce
produce produce
consume consume
write
read
write
read
read
write read
write
1
1 2
<0, p , c >
1
2 2
<1, p ,c >
<0, p ,c >
1 1
<1, p ,c>
<1, p ,c >
<1, p ,c >
2 1
1 2
1
2
2 2 <2, p ,c > 2 2
<2, p ,c > 1 2
<2, p ,c > 2 1
<2, p ,c > 1 1
![Page 14: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/14.jpg)
14
FSMs summary
Simple and widely used:
Most software can be modeled using FSMs FSMs may become complex:
FSMs can be composed to create new FSMs
![Page 15: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/15.jpg)
15
UML diagrams
Use case diagrams Sequence diagrams Collaboration diagrams
![Page 16: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/16.jpg)
16
Use case diagrams
Show all the possible functionality
Do not describe any details Used during requirements analysis
![Page 17: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/17.jpg)
17
Components of use case diagrams
Actors
![Page 18: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/18.jpg)
18
Components of use case diagrams (contd..)
Use Cases
![Page 19: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/19.jpg)
19
Components of use case diagrams (contd..)
Association
![Page 20: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/20.jpg)
20
Uses of use case diagrams
Determining features (requirements):
Communicating with clients:
Generating test cases:
![Page 21: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/21.jpg)
21
Suggestions for designing good use cases
Choose a good name:
Show a complete and completable behavior:
Show inverse use cases if applicable:
Limit a use case to one behavior/function:
Write the use cases from the actor’s point of view:
![Page 22: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/22.jpg)
22
Use case diagrams – Example #1
Consider an airline reservation system. A customer can use this systemto either make or cancel a reservation. The system obtains flight information such as the availability of the flights from an external flight database system. During the process of making a reservation, the system may be required to obtain credit card authorization from the credit card system. Every day, the system compiles a list of passengers with reservations on each flight is forwarded to the security personnel.
![Page 23: Ch5: Software Specification](https://reader035.fdocuments.in/reader035/viewer/2022070412/56814a18550346895db73ea6/html5/thumbnails/23.jpg)
23
Use case diagrams – Example #1
CompileList
Make Reservation
Cancel Reservation
External Flight Database Customer
Use case
Actor
Communication
Reservation System
CreditCard System
SecurityPersonnel