Upload
scot-blair
View
217
Download
2
Tags:
Embed Size (px)
Citation preview
Software EngineeringSoftware Engineering
Chapter 10Chapter 10Formal SpecificationFormal Specification
Ku-Yaw ChangKu-Yaw [email protected]@mail.dyu.edu.tw
Assistant ProfessorAssistant ProfessorDepartment of Computer Science and Information EngineeringDepartment of Computer Science and Information Engineering
Da-Yeh UniversityDa-Yeh University
22Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
ObjectivesObjectives
Understand why formal specification techniques help Understand why formal specification techniques help discover problems in system requirements;discover problems in system requirements;
Understand the use of algebraic techniques of formal Understand the use of algebraic techniques of formal specification to define interface specifications;specification to define interface specifications;
Understand how formal, model-based formal techniques Understand how formal, model-based formal techniques are used for behavioral specfication.are used for behavioral specfication.
33Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
PreamblePreamble
Traditional engineering disciplinesTraditional engineering disciplines Mathematical analysisMathematical analysis
A routine part of the process of developing and validating a A routine part of the process of developing and validating a product designproduct design
Software engineering has not followed the same Software engineering has not followed the same pathpath Formal methods are not widely usedFormal methods are not widely used
44Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
PreamblePreamble
Formal methodsFormal methods Mathematical representation of softwareMathematical representation of software Expressed in a language whose vocabulary, syntax Expressed in a language whose vocabulary, syntax
and semantics are formally definedand semantics are formally defined
Most software developments do not use formal Most software developments do not use formal methodsmethods Successful software engineeringSuccessful software engineering Market changesMarket changes
Quality vs. time to marketQuality vs. time to market Limited scope of formal methodsLimited scope of formal methods Limited scalability of formal methodsLimited scalability of formal methods
55Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
ContentsContents
10.1 Formal specification in the software process10.1 Formal specification in the software process
10.2 Sub-system interface specification10.2 Sub-system interface specification
10.3 Behavioral specification10.3 Behavioral specification
66Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
Formal SpecificationFormal Specification
Formal specificationFormal specification After system requirementsAfter system requirements Before detailed system designBefore detailed system design A tight feedback loop betweenA tight feedback loop between
the detailed requirements specificationthe detailed requirements specification
the formal specificationthe formal specification
One of the main benefitsOne of the main benefits Ability to uncover problems and ambiguities in the Ability to uncover problems and ambiguities in the
system requirementssystem requirements
77Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
Specification and DesignSpecification and Design
Increasing contractor involvement
Decreasing client involvement
Specification
Design
Userrequirements
definition
Systemrequirementsspecification
Architecturaldesign
Formalspecification
High-leveldesign
88Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
Formal SpecificationFormal Specificationin the Software Processin the Software Process
Systemrequirementsspecification
Formalspecification
High-leveldesign
Userrequirements
definition
Systemmodelling
Architecturaldesign
99Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
Software Development CostsSoftware Development Costswith Formal Specificationwith Formal Specification
Specification
Specification
Design andimplementation
Design andimplementation
Validation
Validation
Cost
1010Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
Formal SpecificationFormal Specification
Two fundamental approachesTwo fundamental approaches An algebraic approachAn algebraic approach
In terms of operations and their relationshipsIn terms of operations and their relationships A model-based approachA model-based approach
A model is built using mathematical constructsA model is built using mathematical constructs
1111Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
Formal SpecificationFormal Specification
Different languagesDifferent languages
1212Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
ContentsContents
10.1 Formal specification in the software process10.1 Formal specification in the software process
10.2 Sub-system interface specification10.2 Sub-system interface specification
10.3 Behavioral specification10.3 Behavioral specification
1313Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
Sub-system Interface SpecificationSub-system Interface Specification
A large systemA large system Be decomposed into sub-systemsBe decomposed into sub-systems
Sub-systems make use of other sub-systemsSub-systems make use of other sub-systems
Define sub-system interfacesDefine sub-system interfaces An essential part of the specification processAn essential part of the specification process Sub-systems can be designed and implemented Sub-systems can be designed and implemented
independentlyindependently Clear and unambiguous sub-system interface Clear and unambiguous sub-system interface
specificationsspecifications
1414Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
Sub-system Interface ObjectsSub-system Interface Objects
Interfaceobjects
Sub-systemA
Sub-systemB
1515Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
Structure of an Object SpecificationStructure of an Object Specification
IntroductionIntroduction Defines the sort (the type name) and declares other Defines the sort (the type name) and declares other
specifications that are used.specifications that are used.
DescriptionDescription Informally describes the operations on the type.Informally describes the operations on the type.
SignatureSignature Defines the syntax of the operations in the interface and their Defines the syntax of the operations in the interface and their
parameters.parameters.
AxiomsAxioms Defines the operation semantics by defining axioms which Defines the operation semantics by defining axioms which
characterize behavior.characterize behavior.
1616Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
The Structure ofThe Structure ofan Algebraic Specificationan Algebraic Specification
sort < name >imports < LIST OF SPECIFICATION NAMES >
Informal description of the sort and its operations
Operation signatures setting out the names and the types ofthe parameters to the operations defined over the sort
Axioms defining the operations over the sort
< SPECIFICATION NAME >
1717Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
A Simple List SpecificationA Simple List Specification
Head (Create) = Undefined exception (empty list)Head (Cons (L, v)) = if L = Create then v else Head (L)Length (Create) = 0Length (Cons (L, v)) = Length (L) + 1Tail (Create ) = CreateTail (Cons (L, v)) = if L = Create then Create else Cons (Tail (L), v)
sort Listimports INTEGER
Defines a list where elements are added at the end and removedfrom the front. The operations are Create, which brings an empty listinto existence, Cons, which creates a new list with an added member,Length, which evaluates the list size, Head, which evaluates the frontelement of the list, and Tail, which creates a list by removing the head fromits input list. Undefined represents an undefined value of type Elem.
Create ListCons (List, Elem) ListHead (List) ElemLength (List) IntegerTail (List) List
LIST ( Elem )
1818Ku-Yaw ChangKu-Yaw Chang Formal SepcificationFormal Sepcification
ContentsContents
10.1 Formal specification in the software process10.1 Formal specification in the software process
10.2 Sub-system interface specification10.2 Sub-system interface specification
10.3 Behavioral specification10.3 Behavioral specification
The EndThe End