SWEN 5130Requirements Engineering Algebraic Specification Slide 1 Algebraic Specification u Specifying abstract types in terms of relationships between.

Slides:



Advertisements
Similar presentations
Formal Specifications
Advertisements

1 Note content copyright © 2004 Ian Sommerville. NU-specific content © 2004 M. E. Kabay. All rights reserved. Formal Specification IS301 – Software Engineering.
ML Datatypes.1 Standard ML Data types. ML Datatypes.2 Concrete Datatypes  The datatype declaration creates new types  These are concrete data types,
Programming Languages and Paradigms
Abstraction Lecture-4. ADT example: London Underground Map.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 8 Slide 1 System models.
Katz Formal Specifications Larch 1 Algebraic Specification and Larch Formal Specifications of Complex Systems Shmuel Katz The Technion.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 10 Slide 1 Formal Specification.
CS 225 Section 1 Spring Topics Software design Correctness and Efficiency Inheritance Data structures –Lists, Stacks, Queues –Trees –Sets, Maps.
1 SWE Introduction to Software Engineering Lecture 15 – System Modeling Using UML.
©Ian Sommerville 2000Software Engineering, 6/e, Chapter 91 Formal Specification l Techniques for the unambiguous specification of software.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
Cmp Sci 187: Midterm Review Based on Lecture Notes.
Chapter 10 Classes Continued
1 Working with Classes Chapter 6. 2 Class definition A class is a collection of data and routines that share a well-defined responsibility or provide.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 10 Slide 1 Formal Specification.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 10 Slide 1 Formal Specification.
Abstract data types What does ‘ abstract ’ mean? From Latin: to ‘ pull out ’— the essentials –To defer or hide the details –Abstraction emphasizes essentials.
Software Re-engineering
Formal Methods CIS 376 Bruce R. Maxim UM-Dearborn.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 9 Slide 1 Formal Specification l Techniques for the unambiguous specification of software.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 System models l Abstract descriptions of systems whose requirements are being.
Chapter 4 System Models A description of the various models that can be used to specify software systems.
System models Abstract descriptions of systems whose requirements are being analysed Abstract descriptions of systems whose requirements are being analysed.
©Ian Sommerville 2000Software Engineering, Chapter 10 Slide 1 Chapter 10 Formal Specification.
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 9 Slide 1 Chapter 9 Formal Specifications.
Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor.
Overview of Formal Methods. Topics Introduction and terminology FM and Software Engineering Applications of FM Propositional and Predicate Logic Program.
WXGE6103 Software Engineering Process and Practice Formal Specification.
Chapter 7 System models.
Slide 1 System models. Slide 2 Objectives l To explain why the context of a system should be modelled as part of the RE process l To describe behavioural.
Architectural Design Yonsei University 2 nd Semester, 2014 Sanghyun Park.
System models l Abstract descriptions of systems whose requirements are being analysed.
Modified by Juan M. Gomez Software Engineering, 6th edition. Chapter 7 Slide 1 Chapter 7 System Models.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 7 Slide 1 Chapter 7 System Models.
Reformatted slides from the textbook, C++ How to Program, 6/e Pearson Education, Inc. All rights reserved Chapter 3. [Lecture 02] Introduction to.
Understanding Data Types and Collections Lesson 2.
Chapter 6 – Architectural Design Lecture 1 1Chapter 6 Architectural design.
1 Class Diagrams. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are for visualizing, specifying and documenting.
SWEN 5231 FORMAL METHODS Slide 1 System models u Abstract presentations of systems whose requirements are being analyzed.
Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor.
Chapter 10, Slide 1 ABSTRACT DATA TYPES Based on the fundamental concept of ABSTRACTION:  process abstraction  data abstraction Both provide:  information.
Software Engineering Chapter 10 Formal Specification Ku-Yaw Chang Assistant Professor Department of Computer Science and Information.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Object Oriented Programming
Java Software Solutions Lewis and Loftus Chapter 9 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Enhanced Class Design -- Introduction.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Interfaces and Inner Classes
©Ian Sommerville 2000Software Engineering, Chapter 10 Slide 1 Chapter 10 Formal Specification.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
ISBN Chapter 12 Support for Object-Oriented Programming.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Laurea Triennale in Informatica – Corso di Ingegneria del Software I – A.A. 2006/2007 Andrea Polini IX. System Models (III)
IS301 – Software Engineering V:
Formal Specification.
Algebraic Specifications
An Introduction to Inheritance
Relational Algebra Chapter 4, Sections 4.1 – 4.2
Object-Oriented Programming
Review B.Ramamurthy 4/6/2019 BR.
Algebraic Specification Software Specification Lecture 34
Final Review B.Ramamurthy 5/8/2019 BR.
Software Re-engineering and Reverse Engineering
Presentation transcript:

SWEN 5130Requirements Engineering Algebraic Specification Slide 1 Algebraic Specification u Specifying abstract types in terms of relationships between type operations

SWEN 5130Requirements Engineering Algebraic Specification Slide 2 Objectives u To explain the role of formal specifications in sub-system interface definition u To introduce the algebraic approach to formal specification u To describe the systematic construction of algebraic specifications u To illustrate a number of incremental ways to write algebraic specifications

SWEN 5130Requirements Engineering Algebraic Specification Slide 3 Topics covered u Systematic algebraic specification u Structured specification u Error specification

SWEN 5130Requirements Engineering Algebraic Specification Slide 4 Interface specification u Formal specification is particularly appropriate for defining sub-system interfaces. It provides an unambiguous interface description and allows for parallel sub-system development u Interfaces may be defined as a set of abstract data types or object classes u Algebraic specification is particularly appropriate for ADT specification as it focuses on operations and their relationships

SWEN 5130Requirements Engineering Algebraic Specification Slide 5 Sub-system interfaces

SWEN 5130Requirements Engineering Algebraic Specification Slide 6 Specification structure u Introduction Declares the kind (type of name) of entity being specified and imported specifications u Informal description Informal description of the kind and its operations u Signature Defines the syntax of the interface to the object class or abstract data type u Axioms Defines the semantics of the operations by defining a set of axioms which characterize the behavior of the abstract data type

SWEN 5130Requirements Engineering Algebraic Specification Slide 7 Specification format (Generic Parameter) Sort imports Informal description of the sort and its operations Operation signatures setting out the names and the types of the parameters to the operations defined over the sort Axioms defining the operations over the sort Sort synonymous with Kind

SWEN 5130Requirements Engineering Algebraic Specification Slide 8 Array specification Slide 8 Slide one in Alg_Spec file

SWEN 5130Requirements Engineering Algebraic Specification Slide 9 Systematic algebraic specification u Algebraic specifications of a system may be developed in a systematic way Specification structuring. Specification naming. Operation selection. Informal operation specification Syntax definition Axiom definition

SWEN 5130Requirements Engineering Algebraic Specification Slide 10 Specification operations u Constructor operations. Operations which create entities of the type being specified u Inspection operations. Operations which evaluate entities of the type being specified u To specify behavior, define the inspector operations for each constructor operation

SWEN 5130Requirements Engineering Algebraic Specification Slide 11 Operations on a list ADT u Constructor operations which evaluate to kind List Create, Cons and Tail u Inspection operations which take kind list as a parameter and return some other kind Head and Length. u Tail can be defined using the simpler constructors Create and Cons. No need to define Head and Length with Tail.

SWEN 5130Requirements Engineering Algebraic Specification Slide 12 List specification u Replace with slide 2 in Alg_Spec file

SWEN 5130Requirements Engineering Algebraic Specification Slide 13 Recursion in specifications u Operations are often specified recursively u Tail (Cons (L, v)) = if L = Create then Create else Cons (Tail (L), v) Cons ([5, 7], 9) = [5, 7, 9] Tail ([5, 7, 9]) = Tail (Cons ( [5, 7], 9)) = Cons (Tail ([5, 7]), 9) = Cons (Tail (Cons ([5], 7)), 9) = Cons (Cons (Tail ([5]), 7), 9) = Cons (Cons (Tail (Cons ([], 5)), 7), 9) = Cons (Cons ([Create], 7), 9) = Cons ([7], 9) = [7, 9]

SWEN 5130Requirements Engineering Algebraic Specification Slide 14 Primitive constructors u It is sometimes necessary to introduce additional constructors to simplify the specification u The other constructors can then be defined using these more primitive constructors u In the binary tree specification, a primitive constructor Build is added

SWEN 5130Requirements Engineering Algebraic Specification Slide 15 Operations on a binary tree

SWEN 5130Requirements Engineering Algebraic Specification Slide 16 Binary tree specification u Slide three in Alg_Spec file

SWEN 5130Requirements Engineering Algebraic Specification Slide 17 Structured specification u Specifications should be constructed in a structured way. Other specifications should be reused whenever possible u Specification instantiation. A generic specification is instantiated with a given kind u Incremental specification. Use simple specifications in more complex specifications u Specification enrichment. A specification is constructed by inheritance from other specifications

SWEN 5130Requirements Engineering Algebraic Specification Slide 18 Specification instantiation

SWEN 5130Requirements Engineering Algebraic Specification Slide 19 Incremental specification u Develop a simple specification then use this in more complex specifications u Try to establish a library of specification building blocks that may be reused u In a graphical used interface, the specification of a Cartesian coordinate can be reused in the specification of a cursor u Display operations are hard to specify algebraically. May be informally specified

SWEN 5130Requirements Engineering Algebraic Specification Slide 20 Coord specification Slide four in Alg_Spec file

SWEN 5130Requirements Engineering Algebraic Specification Slide 21 Cursor specification u Replace with portrait slide

SWEN 5130Requirements Engineering Algebraic Specification Slide 22 Specification enrichment u Starting with a reusable specification building block, new operations are added to create a more complex type u Enrichment can be continued to any number of levels. It is comparable to inheritance u Not the same as importing a specification Importing makes a specification available for use Enrichment creates a specification for a new kind u The names of the generic parameters of the base kind are inherited when a kind is enriched

SWEN 5130Requirements Engineering Algebraic Specification Slide 23 Operations on New_list

SWEN 5130Requirements Engineering Algebraic Specification Slide 24 New_list specification Replace with portrait slide

SWEN 5130Requirements Engineering Algebraic Specification Slide 25 Multi-value operations u Some operations affect more than one entity Logically, a function returns more than one value u Stack pop operation returns both the value popped from the stack AND the modified stack u May be modeled algebraically using multiple operations (TOP and RETRACT for a stack) but a more intuitive approach is to define operations which return a tuple rather than a single value

SWEN 5130Requirements Engineering Algebraic Specification Slide 26 Queue operations

SWEN 5130Requirements Engineering Algebraic Specification Slide 27 Queue specification Replace with portrait slide

SWEN 5130Requirements Engineering Algebraic Specification Slide 28 Error specification u Under normal conditions the result of an operation may be kind X but under exceptional conditions, an error should be indicated and the returned kind is different. u Problem may be tackled in three ways Use a special distinguished constant operation (Undefined) which conforms to the type of the returned value. See array specification Define operation evaluation to be a tuple, where an element indicates success of failure. See Queue specification Include a special failure section in the specification

SWEN 5130Requirements Engineering Algebraic Specification Slide 29 List with exception part Replace with portrait slide

SWEN 5130Requirements Engineering Algebraic Specification Slide 30 Key points u Algebraic specification is particularly appropriate for sub-system interface specification u Algebraic specification involves specifying operations on an abstract data types or object in terms of their inter-relationships u An algebraic specification has a signature part defining syntax and an axioms part defining semantics u Formal specifications should have an associated informal description to make them more readable

SWEN 5130Requirements Engineering Algebraic Specification Slide 31 Key points u Algebraic specifications may be defined by defining the semantics of each inspection operation for each constructor operation u Specification should be developed incrementally from simpler specification building blocks u Errors can be specified either by defining distinguished error values, by defining a tuple where one part indicates success or failure or by including an error section in a specification