Specification - PowerPoint PPT Presentation

1 / 50
About This Presentation
Title:

Specification

Description:

Lack of knowledge of computer ... glossary helpful for this purpose. the specification must document all the needed requirements ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 51
Provided by: carlo308
Category:

less

Transcript and Presenter's Notes

Title: Specification


1
Specification
2
Outline
  • Discussion of the term "specification"
  • Types of specifications
  • operational
  • Data Flow Diagrams
  • (Some) UML diagrams
  • Finite State Machines
  • Petri Nets
  • descriptive
  • Entity Relationship Diagrams
  • Logic-based notations
  • Algebraic notations
  • Languages for modular specifications
  • Statecharts
  • Z

3
Specification
  • A broad term that means definition
  • Used at different stages of software development
    for different purposes
  • Generally, a statement of agreement (contract)
    between
  • producer and consumer of a service
  • implementer and user
  • All desirable qualities must be specified

4
Uses of specification
  • Statement of user requirements
  • major failures occur because of misunderstandings
    between the producer and the user
  • Lack of knowledge of computer
  • In most cases the owner does not exactly know
    what he/she wants to be developed
  • "The hardest single part of building a software
    system is deciding precisely what to build"
    (F. Brooks)

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

6
Uses of specification (cont.)
  • Statement of requirements for implementation
  • design process is a chain of specification (i.e.,
    definition)implementationverification steps
  • requirements specification refers to definition
    of external behavior
  • design specification must be verified against it
  • design specification refers to definition of the
    software architecture
  • code must be verified against it

7
Uses of specification (cont.)
  • A reference point during maintenance
  • corrective maintenance only changes
    implementation
  • adaptive and perfective maintenance occur because
    of requirements changes
  • requirements specification must change accordingly

8
Specification qualities
  • Precise, clear, unambiguous
  • Consistent
  • Complete
  • internal completeness
  • external completeness
  • Incremental

9
Clear, unambiguous, understandable
  • Example specification fragment for a
    word-processor

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.
can an area be scattered?
10
Precise, unambiguous, clear
  • Another example (from a real safety-critical
    system)

The message must be triplicated. The three copies
must be forwarded through three different
physical channels. The receiver accepts the
message on the basis of a two-out-of-three
voting policy.
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?
11
Consistent
  • Example specification fragment for a
    word-processor

The 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.
What if the length of a word exceeds the length
of the line?
12
Complete
  • Internal completeness
  • the specification must define any new concept or
    terminology that it uses
  • glossary helpful for this purpose
  • the specification must document all the needed
    requirements
  • difficulty when should one stop?

13
Incremental
  • Referring to the specification process
  • start from a sketchy document and progressively
    add details
  • Referring to the specification document
  • document is structured and can be understood in
    increments

14
Classification of specification styles
  • Informal, semi-formal, formal
  • Operational
  • Behavior specification in terms of some abstract
    machine
  • Descriptive
  • Behavior described in terms of properties and
    input/output relation.

15
Example 1
  • Specification of a geometric figure E

E can be drawn as follows 1. Select two points
P1 and P2 on a plane 2. Get a string of a certain
length and fix its ends to P1 and P2 3. Position
a pencil as shown in next figure 4. Move the pen
clockwise, keeping the string tightly stretched,
until you reach the point where you started
drawing
this is an operational specification
16
(No Transcript)
17
A descriptive specification
  • Ellipse E is described by the following equation
  • ax2 by2 c 0
  • where a, b, and c are suitable constants

18
Another exampleSorting an array of elements
  • Let 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.

OP
  • The result of sorting array a is an array b
    which is a permutation of a and is sorted.

DES
19
How to verify a specification?
  • Observe dynamic behavior of specified system
    (simulation, prototyping, testing specs)
  • Analyze properties of the specified system
  • Analogy with traditional engineering
  • physical model of a bridge
  • mathematical model of a bridge

20
Data Flow Diagrams (DFDs)
  • A semi-formal operational specification
  • System viewed as collection of data manipulated
    by functions
  • Data can be persistent
  • they are stored in data repositories
  • Data can flow
  • they are represented by data flows
  • DFDs have a graphical notation

21
Graphical notation
  • bubbles represent functions
  • arcs represent data flows
  • open boxes represent persistent store
  • closed boxes represent I/O interaction

22
Example
specifies evaluation of (a b) (c a d)
23
A construction method (1)
1. Start from the context diagram
24
A construction method (2)
2. Proceed by refinements until you reach
elementary functions (preserve balancing)
25
A library example
26
Refinement ofGet a book
27
Patient monitoring systems
The purpose is to monitor the patients vital
factors--blood, pressure, temperature, --reading
them at specified frequencies from 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.
28
A refinement
29
More refinement
30
An evaluation of DFDs (1)
  • Easy to read, but
  • Informal semantics
  • How to define leaf functions?
  • Inherent ambiguities
  • Outputs from A, B, C are
  • all needed?
  • Outputs for E and F are
  • produced at the same time?

31
An evaluation of DFDs (2)
  • Control information is absent

Possible 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
32
Formalization/extensions
  • There have been attempts to formalize DFDs
  • There have been attempts to extend DFDs (e.g.,
    for real-time systems)

33
UML diagrams
  • UML (Unified Modeling Language) is a collection
    of languages that provide specific notations to
    specify, analyze, visualize, construct, and
    document the artifacts of a software system
  • In this chapter, we cover use-case diagram,
    sequence diagram, and collaborative diagrams from
    UML.

34
UML use-case diagrams
  • Defines a global view of the actors involved in a
    system and the actions that the system performs,
    which in turn provides an observable result that
    is of value to the actors.
  • Partitions the overall functionality of the
    system into transactions with respect to the
    actor and illustrates how actors interact with
    them.
  • Actors define different roles such as people,
    computer systems, environment


borrow
book

return
book

librarian

customer

library
update

35
Use case diagram
  • Association the communication path between an
    actor and a use case that it participates in
  • Extend The insertion of additional behavior into
    a base use case that does not know about it
  • Generalization relation between a general use
    case and a more specific use case that inherits
    from it.
  • Include the insertion of additional behavior
    into a base use case that explicitly describes
    the insertion

Base use case
Request catalog
Association
Actor
Place order
ltltextentgtgt
Extension use case
ltltincludegtgt
ltltincludegtgt
ltltincludegtgt
Supply Customer data
Arrange payment
Parent use case
Order produce
Inclusion use case
Child use case
Pay cash
Arrange credit
36
UML sequence diagrams
  • Describe how objects interact by exchanging
    messages
  • Provide a dynamic view

37
UML sequence diagram example Ticket selling box
office
38
UML collaboration diagrams
  • Give object interactions and their order
  • Equivalent to sequence diagrams

39
UML collaborative diagram example Ticket selling
box office
40
Finite state machines (FSMs)
  • Can specify control flow aspects
  • Defined 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)
41
Example a lamp
42
Another examplea plant control system
43
A refinement
44
Classes of FSMs
  • Deterministic/nondeterministic
  • FSMs as recognizers
  • introduce final states
  • FSMs as transducers
  • introduce set of outputs
  • . . .

45
FSMs as recognizers
qf is a final state
46
FSMs as recognizers
47
Limitations
  • Finite memory
  • State explosion
  • Given 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 )

48
State explosion an example
49
The resulting FSM
50
FSM simulator
Write a Comment
User Comments (0)
About PowerShow.com