1 CS 501 Spring 2003 CS 501: Software Engineering Lecture 12 Requirements IV.

Slides:



Advertisements
Similar presentations
© Fachgebiet Softwaretechnik, Heinz Nixdorf Institut, Universität Paderborn 2.4 The Z Notation [Reference: M. Spivey: The Z Notation, Prentice Hall]
Advertisements

College of Information Technology & Design
CSCI3170 Introduction to Database Systems
CS1Q Computer Systems Lecture 12 Simon Gay. Lecture 12CS1Q Computer Systems - Simon Gay 2 Design of Sequential Circuits The systematic design of sequential.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
CS 501: Software Engineering Fall 2000 Lecture 10 Formal Specification.
Algorithms and Problem Solving
1 CS 501 Spring 2008 CS 501: Software Engineering Lecture 10 Requirements 3.
1 CS 501 Spring 2006 CS 501: Software Engineering Lecture 10 Requirements 4.
1 CS 501 Spring 2005 CS 501: Software Engineering Lecture 8 Requirements II.
Schema Operators. State We can use the language of schemas to describe the state of a system, and operations upon it. Different aspects of the state --
Mathematical Operators  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming in.
1 CS 501 Spring 2005 CS 501: Software Engineering Lecture 10 Requirements 4.
Encapsulation by Subprograms and Type Definitions
Promotion. Promotion is a structuring technique that may be used whenever the state of a system contains multiple, indexed instances of the same component.
Schema Operators. State We can use the language of schemas to describe the state of a system, and operations upon it. Different aspects of the state --
1 CS 501 Spring 2007 CS 501: Software Engineering Lecture 10 Requirements 4.
C SC 520 Principles of Programming Languages 1 C SC 520: Principles of Programming Languages Peter J. Downey Department of Computer Science Spring 2006.
CS /29/2004 (Recitation Objectives) and Computer Science and Objects and Algorithms.
1 CS 501 Spring 2005 CS 501: Software Engineering Lecture 9 Requirements 3.
1 CSC 1401 S1 Computer Programming I Hamid Harroud School of Science and Engineering, Akhawayn University
Chapter 1 Program Design
ECE 301 – Digital Electronics Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #17)
ECE 331 – Digital Systems Design Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #19)
CS CS 5150 Software Engineering Lecture 10 Requirements 3.
CS CS 5150 Software Engineering Lecture 10 Requirements 3.
1 CS 501 Spring 2006 CS 501: Software Engineering Lecture 9 Requirements 3.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 10 Slide 1 Formal Specification.
The Fundamentals: Algorithms, the Integers & Matrices.
February 17, 2015Applied Discrete Mathematics Week 3: Algorithms 1 Double Summations Table 2 in 4 th Edition: Section th Edition: Section th.
Web Database Design Session 6 and 7 Matakuliah: Web Database Tahun: 2008.
Object-oriented Design CSCI 5801: Software Engineering.
Discrete Mathematics Algorithms. Introduction  An algorithm is a finite set of instructions with the following characteristics:  Precision: steps are.
Course: Software Engineering © Alessandra RussoUnit 1 - Introduction, slide Number 1 Unit 1: Introduction Course: C525 Software Engineering Lecturer: Alessandra.
CS 3610: Software Engineering – Spring 2009 Dr. Hisham Haddad – CSIS Dept. Class Project OO Design Document Here is what you need to do for your class.
Logic Specification and Z Schema 3K04 McMaster. Basic Logic Operators Logical negation ( ¬ ) Logical conjunction ( Λ or & ) Logical disjunction ( V or.
Functions Copyright © J. Mercer, A function is a number-machine that transforms numbers from one set called the domain into a set of new numbers.
Formal Methods and Models
1 CS 501 Spring 2002 CS 501: Software Engineering Lecture 10 Techniques for Requirements Definition and Specification II.
CS CS 5150 Software Engineering Lecture 10 Requirements 3.
1 CMPT 275 Software Engineering Requirements Gathering Activity Janice Regan,
Summary of what we learned yesterday Basics of C++ Format of a program Syntax of literals, keywords, symbols, variables Simple data types and arithmetic.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
© 2005 Prentice Hall9-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Requirements Engineering Methods for Requirements Engineering Lecture-30.
Chapter 4: Subprograms Functions for Problem Solving Mr. Dave Clausen La Cañada High School.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Chapter Algorithms 3.2 The Growth of Functions 3.3 Complexity of Algorithms 3.4 The Integers and Division 3.5 Primes and Greatest Common Divisors.
West Virginia University Slide 1 Copyright © K.Goseva 2010 CS 736 Software Performance Engineering Comments on Homework #1  Please revise the solution.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 3, Lecture 1.
Slide 1 CS 310 Ch 6: Software Requirements Requirements engineering: establishing the services that the customer requires from a system and the constraints.
Introduction to Programming Lecture 11. ARRAYS They are special kind of data type They are special kind of data type They are like data structures in.
ECSE Software Engineering 1I HO 4 © HY 2012 Lecture 4 Formal Methods A Library System Specification (Continued) From Specification to Design.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Homework #2: Functions and Arrays By J. H. Wang Mar. 24, 2014.
1 CS 501 Spring 2004 CS 501: Software Engineering Lecture 9 Requirements 3.
1 Abstract Model Specification. 2 Explicitly describes behavior in terms of a model using well-defined types (viz. set, sequences, relations, functions)
Flowchart. a diagram of the sequence of movements or actions of people or things involved in a complex system or activity. a graphical representation.
1 Specification A broad term that means definition Used at different stages of software development for different purposes Generally, a statement of agreement.
CS 5150 Software Engineering Lecture 9 Requirements 3.
Unified Modeling Language (UML)
1 CS 501 Spring 2003 CS 501: Software Engineering Lecture 11 Requirements III.
8.1 – Sequences and Series. Sequences Infinite sequence = a function whose domain is the set of positive integers a 1, a 2, …, a n are the terms of the.
Applied Discrete Mathematics Week 2: Functions and Sequences
Introduction to Programming
Modeling Shari L. Pfleeger and Joanne M. Atlee, Software Engineering: Theory and Practice, 4th edition, Prentice Hall, Hans Van Vliet, Software Engineering:
Algorithm Discovery and Design
Principles of Computing – UFCFA Week 1
CS 501: Software Engineering Fall 1999
CS 501: Software Engineering Fall 1999
Presentation transcript:

1 CS 501 Spring 2003 CS 501: Software Engineering Lecture 12 Requirements IV

2 CS 501 Spring 2003 Course Administration Quiz 2, Question 1(a) Grading of this part of Question 1 was inconsistent. If you would like me to regrade your solution, please return you answer book. Quiz 1 and Quiz 2 The quizzes have been mounted on the Web site. If you have questions abour grading, please compare your solution to the question.

3 CS 501 Spring 2003 Formal Specification Why? Precise standard to define and validate software. Why not? May be time consuming Methods are not suitable for all applications

4 CS 501 Spring 2003 Formal Specification using Mathematical Notation Example from a mathematical software package: B 1, B 2,... B k is a sequence of m x m matrices  1,  2,...  k is a sequence of m x m elementary matrices B 1 -1 =  1 B 2 -1 =  2  1 B k -1 =  k...  2  1 The numerical accuracy must be such that, for all k, B k B k -1 - I < 

5 CS 501 Spring 2003 Formal Specification Using Diagrams digit unsigned integer digit. E + - unsigned integer unsigned number Pascal number syntax

6 CS 501 Spring 2003 Formal Specification of Programming Languages ::= | ::= { } ::=. { } |. { } E | E ::= | ::= + | - Pascal number syntax

7 CS 501 Spring 2003 Formal Specification using Z ("Zed") Ben Potter, Jane Sinclair, David Till, An Introduction to Formal Specification and Z (Prentice Hall) 1991 Jonathan Jacky The Way of Z (Cambridge University Press) 1997

8 CS 501 Spring 2003 Remember Formal specification does not guarantee correctness Formal specification does not prescribe the implementation

9 CS 501 Spring 2003 Informal: The function intrt(a) returns the largest integer whose square is less than or equal to a. Formal (Z): intrt: N N a : N intrt(a) * intrt(a) < a < (intrt(a) + 1) * (intrt(a) + 1) Example: Specification using Z

10 CS 501 Spring 2003 Example: Algorithm (2n - 1) = n 2 Static specification does not describe the design of the system. A possible algorithm uses the mathematical identity:

11 CS 501 Spring 2003 Example: Program int intrt (int a) /* Calculate integer square root */ { int i, term, sum; term = 1; sum = 1; for (i = 0; sum <= a; i++) { term = term + 2; sum = sum + term; } return i; }

12 CS 501 Spring 2003 Formal Specification of Finite State Machine Using Z A finite state machine is a broadly used method of formal specification: Event driven systems (e.g., games) User interfaces Protocol specification etc., etc.,...

13 CS 501 Spring 2003 State Transition Diagram Patients Fields SetupReady Beam on Enter Start Stop Select field Select patient (interlock) (ok)

14 CS 501 Spring 2003 State Transition Table Select Patient Select Field Enter ok StartStop interlock Patients Fields Setup Ready Beam on Fields Patients Setup Ready Beam on Ready

15 CS 501 Spring 2003 Z Specification STATE ::= patients | fields | setup | ready | beam_on EVENT ::= select_patient | select_field | enter | start | stop | ok | interlock FSM == (STATE X EVENT) STATE no_change, transitions, control : FSM Continued on next slide

16 CS 501 Spring 2003 Z Specification (continued) control = no_change transitions no_change = { s : STATE; e : EVENT (s, e) s } transitions = { (patients, enter) fields, (fields, select_patient) patients, (fields, enter) setup, (setup, select_patient) patients, (setup, select_field) fields, (setup, ok) ready, (ready, select_patient) patients, (ready, select_field) fields, (ready, start) beam_on, (ready, interlock) setup, (beam_on, stop) ready, (beam_on, interlock) setup }

17 CS 501 Spring 2003 Schemas Schema: The basic unit of formal specification. Enables complex system to be specifed as subsystems Describes admissible states and operations of a system.

18 CS 501 Spring 2003 LibSys: An Example of Z Library system: Stock of books. Registered users. Each copy of a book has a unique identifier. Some books on loan; other books on shelves available for loan. Maximum number of books that any user may have on loan.

19 CS 501 Spring 2003 LibSys: Operations Issue a copy of a book to a reader. Reader returns a book. Add a copy to the stock. Remove a copy from the stock. Inquire which books are on loan to a reader. Inquire which readers has a particular copy of a book. Register a new reader. Cancel a reader's registration.

20 CS 501 Spring 2003 LibSys Level of Detail: Assume given sets: Copy, Book, Reader Global constant: maxloans

21 CS 501 Spring 2003 Domain and Range dom mXY x ran m y m : X Y dom m = { x  X :  y  Y  x y} ran m = { y  Y :  x  X  x y} m domain: range:

22 CS 501 Spring 2003 LibSys: Schema for Abstract States Library stock : Copy Book issued : Copy Reader shelved : F Copy readers: F Reader shelved  dom issued = dom stock shelved  dom issued = Ø ran issued  readers  r : readers #(issued  {r}) maxloans <

23 CS 501 Spring 2003 Schema Inclusion LibDB stock : Copy Book readers: F Reader LibLoans issued : Copy Reader shelved : F Copy  r : Reader #(issued  {r}) maxloans shelved  dom issued = Ø <

24 CS 501 Spring 2003 Schema Inclusion (continued) Library LibDB LibLoans dom stock = shelved  dom issued ran issued  readers

25 CS 501 Spring 2003 Schemas Describing Operations Naming conventions for objects: Before: plain variables, e.g., r After: with appended dash, e.g., r' Input: with appended ?, e.g., r? Output: with appended !, e.g., r!

26 CS 501 Spring 2003 Operation: Issue a Book Inputs: copy c?, reader r? Copy must be shelved initially: c?  shelved Reader must be registered: r?  readers Reader must have less than maximum number of books on loan: #(issued  {r?}) < maxloans Copy must be recorded as issued to the reader: issued' = issued  {c? r?} The stock and the set of registered readers are unchanged: stock' = stock; readers' = readers

27 CS 501 Spring 2003 Operation: Issue a Book stock, stock' : Copy Book issued, issued' : Copy Reader shelved, shelved': F Copy readers, readers' : F Reader c?: Copy; r? :Reader [See next slide] Issue

28 CS 501 Spring 2003 Operation: Issue a Book (continued) [See previous slide] Issue shelved  dom issued = dom stock shelved'  dom issued' = dom stock' shelved  dom issued = Ø; shelved'  dom issued' = Ø ran issued  readers; ran issued'  readers'  r : readers  #(issued  {r}) maxloans  r : readers'  #(issued'  {r}) maxloans c?  shelved; r?  readers; #(issued  {r?}) < maxloans issued' = issued  {c? r?} stock' = stock; readers' = readers < <

29 CS 501 Spring 2003 Schema Decoration Issue Library Library' c? : Copy; r? : Reader c?  shelved; r?  readers #(issued  {r?}) < maxloans issued' = issued  {c? r?} stock' = stock; readers' = readers

30 CS 501 Spring 2003 Schema Decoration Issue  Library c? : Copy; r? : Reader c?  shelved; r?  readers #(issued  {r?}) < maxloans issued' = issued  {c? r?} stock' = stock; readers' = readers

31 CS 501 Spring 2003 The Schema Calculus Schema inclusion Schema decoration Schema disjunction: AddCopy AddKnownTitle  AddNewTitle Schema conjunction: AddCopy EnterNewCopy  AddCopyAdmin Schema negation Schema composition = ^ = ^