chapter 5
TRANSCRIPT
-
Ch. 5*Specification
Ch. 5
-
Ch. 5*OutlineDiscussion of the term "specification"Types of specificationsoperational Data Flow Diagrams(Some) UML diagramsFinite State MachinesdescriptiveEntity Relationship Diagrams
Languages for modular specifications Statecharts
Ch. 5
-
Ch. 5*SpecificationDiscussion of the term "specification"What does software specification mean?Do we need that?
-
Ch. 5*
-
Ch. 5*SpecificationA broad term that means definitionUsed at different stages of software development for different purposesGenerally, a statement of agreement (contract) betweenproducer and consumer of a serviceimplementer and userAll desirable qualities must be specified
Ch. 5
-
Ch. 5*Uses of specificationStatement of user requirementsmajor failures occur because of misunderstandings between the producer and the user "The hardest single part of building a software system is deciding precisely what to build" (F. Brooks)
Ch. 5
-
Ch. 5*Uses of specification (cont.)Statement of the interface between the machine and the controlled environment serious undesirable effects can result due to misunderstandings between software engineers and domain experts about the phenomena affecting the control function to be implemented by software
Ch. 5
-
Ch. 5*Uses of specification (cont.)A reference point during maintenancecorrective maintenance only changes implementationadaptive and perfective maintenance occur because of requirements changesrequirements specification must change accordingly
Ch. 5
-
Ch. 5*Specification qualitiesPrecise, clear, unambiguousConsistentComplete Incremental
Ch. 5
-
Ch. 5*Clear, unambiguous, understandableExample: specification fragment for a word-processor. A select command.
Selecting is the process of designating areas of the document that you want to work on. Most editing and formatting actions require two steps: first you select what you want to work on, such as text or graphics; then you initiate the appropriate action.
Ch. 5
-
Ch. 5*Clear, unambiguous, understandableExample: specification fragment for a word-processor. A select command.
What does area mean? Can an area be a collection of sequence of scattered characters?
-
Ch. 5*Precise, unambiguous, clearAnother example (from a real safety-critical system)The message must be triplicated. The threecopies must be forwarded through three different physical channels. The receiver accepts the message on the basis of a two-out-of-three voting policy.
Ch. 5
-
Ch. 5*Precise, unambiguous, clearAnother example (from a real safety-critical system)Can a message be accepted as soon as we receive 2 out of 3 identical copies of message or do we need to wait for receipt of the 3rd?
-
Ch. 5*ConsistentExample: specification fragment for a word-processorThe whole text should be kept in lines of equal length. The length is specified by the user. Unless the user gives an explicit hyphenation command, a carriage return should occur only at the end of a word.
Ch. 5
-
Ch. 5*ConsistentExample: specification fragment for a word-processorWhat if the length of a word exceeds the length of the line?
-
Ch. 5*CompleteInternal completenessthe specification must define any new concept or terminology that it uses glossary helpful for this purpose the specification must document all the needed requirementsdifficulty: when should one stop?
Ch. 5
-
Ch. 5*IncrementalReferring to the specification processstart from a sketchy document and progressively add detailsReferring to the specification documentdocument is structured and can be understood in increments
Ch. 5
-
Ch. 5*Classification of specification stylesInformal, semi-formal, formalOperationalBehavior specification in terms of some abstract machineDescriptiveBehavior described in terms of properties
Ch. 5
-
Ch. 5*Example 1Specification of a geometric figure E:E can be drawn as follows:1.Select two points P1 and P2 on a plane2.Get a string of a certain length and fix its ends to P1 and P23.Position a pencil as shown in next figure4.Move the pen clockwise, keeping the string tightly stretched, until you reach the point where you started drawing
this is an operational specification
Ch. 5
-
Ch. 5*Implementing the specification of a circle
Ch. 5
-
Ch. 5*A descriptive specificationGeometric figure E is described by the following equationax2 + by2 + c = 0where a, b, and c are suitable constants
Ch. 5
-
Ch. 5*Another exampleLet a be an array of n elements. The result of its sorting is an array b of n elements such that the first element of b is the minimum of a (if several elements of a have the same value, any one of them is acceptable); the second element of b is the minimum of the array of n-1 elements obtained from a by removing its minimum element; and so on until all n elements of a have been removed.The result of sorting array a is an array b which is a permutation of a and is sorted.
OPDES
Ch. 5
-
Ch. 5*How to verify a specification?Observe dynamic behavior of specified system (simulation, prototyping, testing specs)Analyze properties of the specified systemAnalogy with traditional engineeringphysical model of a bridgemathematical model of a bridge
Ch. 5
-
Ch. 5*Data Flow Diagrams (DFDs)A semi-formal operational specificationSystem viewed as collection of data manipulated by functionsData can be persistentthey are stored in data repositoriesData can flow they are represented by data flowsDFDs have a graphical notation
Ch. 5
-
Ch. 5*Graphical notationbubbles represent functionsarcs represent data flowsopen boxes represent persistent storeclosed boxes represent I/O interaction
Ch. 5
-
Ch. 5*Examplespecifies evaluation of(a + b) * (c + a * d)
Ch. 5
b
c
d
a
*
+
*
+
-
Ch. 5*A construction method (1)1. Start from the context diagram
Ch. 5
...
...
Input
1
Input
2
Input
n
Output
1
Output
2
Output
m
information
system
-
Ch. 5*A construction method (2)2. Proceed by refinements until you reach elementary functions (preserve balancing)
Ch. 5
EMBED Word.Picture.8
_983548766.unknown
-
Ch. 5*A library systemUser request consisting of title, name of authorAccess to the shelves that contain the book. List of authorsList of titlesUsers name
Ch. 5
-
Ch. 5*A library example
Ch. 5
EMBED Word.Picture.8
_983548767.unknown
-
Ch. 5*Refinement ofGet a book
Ch. 5
EMBED Word.Picture.8
_983548768.unknown
-
Ch. 5*An evaluation of DFDsSemantics of the symbols is determined only by the identifiers provided (find book position, +)Access to the shelves that contain the book. List of authorsList of titlesUsers name
Ch. 5
-
Ch. 5*Patient monitoring systemsThe purpose is to monitor the patients vital factors--blood,pressure, temperature, --reading them at specified frequenciesfrom analog devices and storing readings in a DB. If readings fall outside the range specified for patient or device fails an alarm must be sent to a nurse. The system also provides reports.
Ch. 5
-
Ch. 5*An evaluation of DFDs (1)Semantics of the symbols is determined only by the identifiers provided (find book position, +)Attractive graphical notation suitable for capturing, in a fairly immediate and intuitive way, the flow of data and the operations involved in an information system.Its intuitive meaning not suitable for machine interpretation.
Ch. 5
-
Ch. 5*An evaluation of DFDs (2)Easy to read, but Informal semanticsHow to define leaf functions?Inherent ambiguitiesOutputs from A, B, C are all needed?Outputs for E and F areproduced at the same time?
Ch. 5
EMBED Word.Picture.8
_983548774.unknown
-
Ch. 5*An evaluation of DFDs (3)Control information is absentPossible interpretations:(a)A produces datum, waits until B consumes it(b)B can read the datum many times without consuming it(c)a pipe is inserted between A and B. A denotes computing time spent by employees in their work and B denotes computing a payroll.
Ch. 5
EMBED Word.Picture.8
_983548775.unknown
-
Ch. 5*Formalization/extensionsThere have been attempts to formalize DFDsThere have been attempts to extend DFDs (e.g., for real-time systems)
Ch. 5
-
Ch. 5*UML use-case diagramsDefine functions on basis of actors and actions
Ch. 5
-
Ch. 5*UML sequence diagramsDescribe how objects interact by exchanging messagesProvide a dynamic view
Ch. 5
-
Ch. 5*UML collaboration diagramsGive object interactions and their orderEquivalent to sequence diagrams
Ch. 5
-
Ch. 5*Finite state machines (FSMs)Can specify control flow aspectsDefined as
a finite set of states, Q;a finite set of inputs, I;a transition function d : Q x I Q(d can be a partial function)
Ch. 5
-
Ch. 5*Example: a lamp
Ch. 5
-
Ch. 5*Another example:a plant control system
Ch. 5
On
Off
High-pressure alarm
High-temperature alarm
Restart
-
Ch. 5*A refinement
Ch. 5
EMBED Word.Picture.8
_983548790.unknown
-
Ch. 5*Classes of FSMsDeterministic/nondeterministicFSMs as recognizersintroduce final statesFSMs as transducersintroduce set of outputs. . .
Ch. 5
-
Ch. 5*FSMs as recognizersqf is a final state
Ch. 5
-
Ch. 5*FSMs as recognizers
Ch. 5
-
Ch. 5*LimitationsFinite memoryState explosionGiven a number of FSMs with k1, k2, kn states, their composition is a FSM with k1 * k2 * * kn. This growth is exponential with the number of FSMs, not linear (we would like it to be k1 + k2 + + kn )
Ch. 5
-
Ch. 5*State explosion: an example
Ch. 5
Producer
p
1
c
2
Storage
1
produce
deposit
get
consume
deposit
get
get
deposit
p
2
Consumer
c
1
2
0
-
Ch. 5*The resulting FSM
Ch. 5
-
Ch. 5*Declarative specificationsER diagrams: semiformal specsLogic specificationsAlgebraic specifications
Ch. 5
-
Ch. 5*ER diagramsOften used as a complement to DFD to describe conceptual data modelsBased on entities, relationships, attributesThey are the ancestors of class diagrams in UML
Ch. 5
-
Ch. 5*Example
Ch. 5
EMBED Word.Picture.8
_984055736.unknown
-
Ch. 5*RelationsRelations can be partialThey can be annotated to defineone to oneone to manymany to onemany to many
Ch. 5
_984055737.unknown
_984872727.doc
A
R
B
A
R
B
A
R
B
A
R
B
-
Ch. 5*Non binary relations
Ch. 5
_984872991.doc
Director
Project
Employee
Dipartment
Assigned
Participates
HeadOf
Data
Duration
_984873289.doc
Director
Project
Employee
Department
Assigned
Participates
HeadOf
Data
Duration
_984873331.doc
Director
Project
Employee
Department
Assigned
Participate
HeadOf
Data
Duration
_984055738.unknown
-
Ch. 5*Modularizing finite state machines
Ch. 5
-
Ch. 5*Modularizing finite state machinesStatecharts do thatThey have been incorporated in UMLThey provide the notions ofsuperstatestate decomposition
Ch. 5
-
Ch. 5*Sequential decomposition--chemical plant control example--
Ch. 5
-
Ch. 5*Parallel decomposition
Ch. 5
-
Ch. 5*Object state diagram using Statecharts
Ch. 5
-
Ch. 5*Object state diagram using Statecharts
Ch. 5
-
Ch. 5*Specifications for the end-userSpecs should be used as common reference for producer and userThey help removing ambiguity, incompleteness, Can they be understood by end-user?They can be the starting point for a prototypeThey can support some form of animation
Ch. 5
-
Ch. 5*Conclusions (1)Specifications describewhat the users need from a system (requirements specification)the design of a software system (design and architecture specification)the features offered by a system (functional specification)the performance characteristics of a system (performance specification)the external behavior of a module (module interface specification) the internal structure of a module (internal structural specification)
Ch. 5
-
Ch. 5*Conclusions (2)Descriptions are given via suitable notationsThere is no ideal notationThey must be modularThey support communication and interaction between designers and users
Ch. 5