3.
Software Specification
3.1
Uses of specification,
3.2
Classification of specification,
3.3
Verification of specifications,
3.4
Operational and descriptive specifications, building and using specifications.
Software
specification
In
broad term, specification means definition. Software specification is used in
different stages of the software development for different purpose. In general
term, software specification is the agreement or contract between producer of
the service and consumer of the service or the implementer and the user. All
the desirable qualities and requirements are specified in software
specification document. There are different types of specifications such as
requirement specification (which is the agreement between end user and system
developer), design specification (is an agreement between system designer and
implementer) and module specification (is an agreement between programmer using
module and programmer implementing module.
Uses
of specification
In
every stages of the software development specification document is created for
different purpose. The major uses of specification document are:
1.
A statement of user requirement.
The
primary purpose of any software product is to fulfill user requirements. During
the phase of requirement specification of software development, all the
requirements of the user are specified in a specification document. This
document is used to design new system as well as to remove misunderstandings
and ambiguity in the existing system.
2.
A statement of the interface between the machine and controlled environment.
Computers
interact with the external environment by receiving inputs from the sensors of
a controlled plant or commands from a user and provide output. A flawed
specification or a misunderstanding between software engineer and expert in the
given domain may result serious undesirable effect. It is therefore necessary
to specify the interface between the machine and the controlled environment by
describing precisely inputs, outputs and expected relationships including
specification of time constraints that the controlled should satisfy. For such
purpose, finely refined specification document is required.
3.
A statement of the requirements for the implementation.
Specifications
are used as a reference point while the product is being implemented. The
ultimate goal of the implementation is to build a product that meets the
specifications. Thus the implementation uses the specifications during the
design phase to make design decision and during the verification activity to
check that the implementation compiles with the specification.
4. A
reference point during product maintenance.
Specification
is used in maintenance of the software product. There are several kinds of
maintenance such as:
Adaptive maintenance:
Adaptive
maintenance occurs because of changes in the requirements. Among such changes
are the modifications of the functionality of the product. The new
implementation must be checked against the specifications for correctness.
Corrective
maintenance
In
corrective maintenance only the implementation is changed. Thus the
specification is required to check whether the new implementation corrects the
errors contained in the previous version of the product.
Perfective
maintenance
In
perfective maintenance, the users may wish to restructure the design of a
product in an attempt to gain an improvement in performance and inclusion of
new functions or the modification of an existing function. Specification is
required to understand the impact of the change clearly and to accomplish the
change reliably.
Classification
of specification
Specifications
are classified as:
Formal
Specification
Specifications
that are written by using notations that has precise syntax and meaning is
known as formal specification. The textual design notations (TDN) and graphical
design notations (GDN) are used to write a formal specification.
Informal
Specification
Specifications
that are written in a natural language are known as informal specification.
They can also use figures, tables and other notations to provide more clear
structure and understanding. Informal specification can also be structured in a
standardized way.
Operational
Specification
The
operational specification describes the system by describing its desired
behavior by providing a model implementation of the system. For example:
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
Fig: implementing the specification of a circle
Another
example of operational specification is sorting of an array:
“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.”
Descriptive
Specification
Declarative
specifications try to state the desired properties of the system in a purely
declarative fashion and the behavior is described in terms of properties of the
system. Descriptive specifications are more abstract then operational
specifications. They focus on essential properties of the system without
modeling the behavior of any implementation. The descriptive specification of
the above curve drawing example is:
Geometric
figure E is describe by the following equation
ax2
+ by2 + c = 0 where a, b, and c are suitable constants
Verification
of specifications
Specification
is used as a reference document for an implementation. So before using it for
implementation, it must be verified in order to assess the correctness.
Following are general ways of verifying a specification:
- Observing dynamic
behavior of specified system in order to check whether it conforms to the
intuitive understanding of the behavior of the ideal system. (simulation,
prototyping, testing)
- Analyze properties of the
specified system that can be deduced from the specification.
-
Verify all three aspect of the specifications:
o Functional
It
is necessary to see the functional part of the specification to verify the
specification.
o Consistency
To
verify the specification, it is necessary to see the consistency of the
specification.
o Completeness
Verify
whether the specifications is complete or not (internally or externally). The
specification is internally complete, if it defines any new concept or
terminology it uses in the specification and externally complete, if it include
all the requirements.
Operational
specification
Operational
specification uses formal and semi-formal notations. They are
Data
Flow Diagram (DFD):
• A semi-formal operational
specification
• System viewed as
collection of data manipulated by “functions”
•
Data can be persistent
–
they are stored in data repositories
The
function symbol The data f low symbol The data store symbol The input dev ice
symbol The output dev ice symbol
•
Data can flow
–
they are represented by data flows
•
DFDs have a graphical notation
– bubbles represent
functions
– arcs represent
data flows
– open boxes represent
persistent store
– closed
boxes represent I/O interaction
UML
use-case diagrams
•
Define functions on basis of actors and actions
Librarian
Catalogue member card + book request membership OK book request book available
book borrowed time Customer Customer Librarian Catalogue 1: member card + book
request 2: membership OK 3: book request 4: book available 5: book borrowed
UML sequence diagrams
• Describe how objects
interact by exchanging messages
•
Provide a dynamic view
UML
collaboration diagrams
• Give object interactions
and their order
•
Equivalent to sequence diagrams
Declarative specifications
Descriptive
specification also uses semi-formal and informal notations such as ER-Diagram,
logic specifications algebraic specifications.
ER-Diagram
• Often used as a
complement to DFD to describe conceptual data models
•
Based on entities, relationships, attributes
STUDENTCLASSENROLLED_INNAMESEXAGESUBJECTCOURSE_IDMAX_ENROLLMENT
Logic
specifications
Declarative
specification uses the logical specification such as first order theory.
Examples
of first-order theory (FOT) formulas:
• x > y and y
> z implies x > z
• x = y ยบ y
= x
• for all x,
y, z (x > y and y > z implies x > z)
• x + 1 < x – 1
• for all x
(exists y (y = x + z))
• x
> 3 or x < -6
Algebraic
specifications
Algebraic
specifications use algebraic expressions to write the declarative
specification. For example:
• A
system for strings, with operations for
– creating new, empty
strings (operation new)
– concatenating strings
(operation append)
– adding a new character at
the end of a string (operation add)
– checking the length of a
given string (operation length)
– checking whether a string
is empty (operation isEmpty)
–
checking whether two strings are equal (operation equal)
•
algebra String Spececification introduces
sorts
String, Char, Nat, Bool;
operations
new:
()® String;
append:
String, String ® String;
add:
String, Char ® String;
length:
String ® Nat;
isEmpty:
String ® Bool;
equal:
String, String ® Bool
No comments:
Post a Comment