© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Operation, Algorithm, and Data Structure Specification, and Design Finalization.

Slides:



Advertisements
Similar presentations
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Advertisements

Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Contd... Objectives Explain the design, use, and operation of a linear list Implement a linear.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Architectural Modeling Notations.
ISBN Chapter 3 Describing Syntax and Semantics.
Software Engineering and Design Principles Chapter 1.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Process Specifications and Structured Decisions Systems Analysis and Design, 8e Kendall.
Detailed Design Kenneth M. Anderson Lecture 21
Chapter 9 Describing Process Specifications and Structured Decisions
Chapter 9 Describing Process Specifications and Structured Decisions Systems Analysis and Design Kendall & Kendall Sixth Edition © 2005 Pearson Prentice.
Chapter 15 Design, Coding, and Testing. Copyright © 2005 Pearson Addison-Wesley. All rights reserved Design Document The next step in the Software.
Chapter 9 Describing Process Specifications and Structured Decisions
1 Specifying Object Interfaces. 2 Major tasks in this stage: --are there any missing attributes or operations? --how can we reduce coupling, make interface.
Software Testing and Quality Assurance
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
Fall 2007CS 2251 Software Engineering Intro. Fall 2007CS 2252 Topics Software challenge Life-cycle models Design Issues Documentation Abstraction.
PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 © John Wiley & Sons, Inc. All rights reserved. Slide 1.
Kendall & KendallCopyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 9 Kendall & Kendall Systems Analysis and Design, 9e Process Specifications.
Chapter 1 Principles of Programming and Software Engineering.
Chapter 1 Program Design
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 2: Algorithm Discovery and Design
Sept Ron McFadyen1 Extend Relationship.
 QUALITY ASSURANCE:  QA is defined as a procedure or set of procedures intended to ensure that a product or service under development (before work is.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Kendall & KendallCopyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 9 Kendall & Kendall Systems Analysis and Design, 9e Process Specifications.
System Implementation System Implementation - Mr. Ahmad Al-Ghoul System Analysis and Design.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Use Cases Descriptions and Use Case Models.
Object Oriented Data Structures
Chapter 9 Describing Process Specifications and Structured Decisions
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Architectural Design.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
CS Fall 2007 Dr. Barbara Boucher Owens. CS 2 Text –Main, Michael. Data Structures & Other Objects in Java Third Edition Objectives –Master building.
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Product Design Finalization; Inspections.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
WXGE6103 Software Engineering Process and Practice Formal Specification.
Low-Level Detailed Design SAD (Soft Arch Design) Mid-level Detailed Design Low-Level Detailed Design Design Finalization Design Document.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
4. The process specification (プロセス仕様) You will learn: (次の内容を学び) The concept of process specification (プロセス 仕様の概念) Notations for process specification (プロセス.
Algorithms & Flowchart
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Activity Diagrams.
Chapter 3 Part II Describing Syntax and Semantics.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
Topic 4 - Database Design Unit 1 – Database Analysis and Design Advanced Higher Information Systems St Kentigern’s Academy.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Chapter 16 Quality Assurance Through Software Engineering Systems Analysis and Design Kendall & Kendall Sixth Edition.
Winter 2006CISC121 - Prof. McLeod1 Stuff No stuff today!
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 3rd Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
Chapter 1 The Phases of Software Development. Software Development Phases ● Specification of the task ● Design of a solution ● Implementation of solution.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Copyright © 2011 Pearson Education Process Specifications and Structured Decisions Systems Analysis and Design, 8e Kendall & Kendall Global Edition 9.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 20: Binary Trees.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Activity Diagrams.
Principles of Programming & Software Engineering
Design by Contract Jim Fawcett CSE784 – Software Studio
Design by Contract Jim Fawcett CSE784 – Software Studio
Computer Programming.
Slides by Steve Armstrong LeTourneau University Longview, TX
Chapter 11 Describing Process Specifications and Structured Decisions
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
Unit Testing.
Presentation transcript:

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Operation, Algorithm, and Data Structure Specification, and Design Finalization

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2 Objectives  To present operation specifications and their contents  To present design by contract for declarative specification of operation behavior  To introduce minispecs and pseudocode for algorithm specification  To introduce data structure diagrams for data structure specification  To survey design finalization

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 3 Topics  Operation specifications  Declarative and procedural behavior specification  Design by contract Assertions, preconditions, postconditions, and class invariants  Algorithm specification  Data structure specification  Design finalization

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4 Operation Specification (Op-Spec) Structured text stating an operation’s interface and responsibilities Class or module—Identifies the operation Signature—Operation name, names and types of parameters, return type, and perhaps more (syntax) Description—Sentence or two Behavior—Semantics and pragmatics Implementation—Optional

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5 Behavior Specification  Procedural—Describes an algorithm for transforming inputs to outputs An algorithm is a sequence of steps that can be performed by a computer.  Declarative—Describes inputs, outputs, calling constraints, and results without specifying an algorithm

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 6 Declarative Specification Advantages  More abstract because they ignore implementation details—more concise  Focus on the interface, not the internals  Do not bias programmers towards a particular implementation as procedural specifications might

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 7 Design by Contract A contract is a binding agreement between two or more parties. An operation contract is a contract between an operation and its callers. A contract is a binding agreement between two or more parties. An operation contract is a contract between an operation and its callers.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 8 Contract Rights and Obligations  The caller Is obliged to pass valid parameters under valid conditions, and Has the right to delivery of advertised computational services.  The called operation Is obliged to provide advertised services, and Has the right to be called under valid conditions with valid parameters.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 9 Assertions Assertions state caller and called operation right and obligations. An assertion is a statement that must be true at a designated point in a program.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10 Preconditions and Postconditions A precondition is an assertion that must be true at the initiation of an operation. A postcondition is an assertion that must be true upon completion of an operation. A precondition is an assertion that must be true at the initiation of an operation. A postcondition is an assertion that must be true upon completion of an operation.  Preconditions state caller obligations and called operation rights.  Postconditions state caller rights and called operation obligations.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 11 Operation Specification Example Signaturepublic static int findMax( int[] a ) throws IllegalArgumentException ClassUtility DescriptionReturn one of the largest elements in an int array. Behaviorpre: (a != null) && (0 < a.length) post: for every element x of a, x <= result post: throws IllegalArgumentException if preconditions are violated

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 12 Class Invariants Class invariants augment every exported operation’s contract. A class invariant is an assertion that must be true of any class instance between calls of its exported operations.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 13 What to Put in Assertions 1  Preconditions: Restrictions on parameters Conditions that must have been established before the call  Postconditions Relationships between parameters and results Restrictions on results Changes to parameters Responses to violated preconditions

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 14 What to Put in Assertions 2  Class invariants Restrictions on attributes Relationships among attributes  State empty assertions as “true” or “none.”

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 15 Developing Op-Specs  Don’t make detailed op-specs early in mid- level design The design is still fluid and many details will change  Don’t wait until the end of design Details will have been forgotten Probably will be done poorly  Develop op-specs gradually during design, adding details as they become firm

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 16 Algorithm Specification  Specify well-known algorithms by name.  Use a minispec, a step-by-step description of how an algorithm transforms its inputs to output.  Write minispecs in pseudocode, English augmented with programming language constructs.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 17 Pseudocode Example Inputs:array a, lower bound lb, upper bound ub, search key Outputs:location of key, or -1 if key is not found lo = lb hi = ub while lo <= hi and key not found mid = (lo + hi) / 2 if ( key = a[mid] ) then key is found else if ( key < a[mid] ) then hi = mid-1 else lo = mid+1 if key is found then return mid else return -1

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 18 Data Structures  Contiguous implementation—Values are stored in adjacent memory cells  Linked implementation—Values are stored in arbitrary cells accessed using references or pointers A data structure is scheme for storing data in computer memory.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 19 Data Structure Diagrams  Rectangles represent memory cells, possibly with names  Contiguous cells are represented by adjacent rectangles; cells may have indices  Repeated elements are indicated by ellipses  Linked cells are shown using arrows to represent pointers or references from one cell to another  A dot represents the null pointer

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 20 Data Structure Diagram Example 1

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 21 Data Structure Diagram Example 2

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 22 Data Structure Diagram Heuristics  Label record fields only once.  Use ellipses to simplify large, repetitive structures.  Draw linked structures so that the pointers point down the page or from left to right.  Identify unusual or additional symbols with a legend.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 23 Design Finalization  Low-level design specifications complete a design document.  Design finalization is checking the design to make sure it is of sufficient quality and is well documented.  This is the last step in the engineering design process.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 24 Design Document Quality Characteristics 1  Feasibility—Must be possible to realize the design  Adequacy—Must specify a program that will meet its requirements  Economy—Must specify a program that can be built on time and within budget  Changeability—Must specify a program that can be changed easily

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 25 Design Document Quality Characteristics 2  Well-Formedness—Design must use notations correctly  Completeness—Must specify everything that programmers need to implement the program  Clarity—Must be as easy to understand as possible  Consistency—Must contain specifications that can be met by a single product

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 26 Critical Reviews Critical reviews can utilize Desk checks, Walkthroughs, Inspections, Audits, and Active reviews. A critical review is an evaluation of a finished product to determine whether it is of acceptable quality.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 27 A Critical Review Process

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 28 Continuous Review  A critical review that finds serious design defects may result in a return to a much earlier stage of design. Expensive Time consuming Frustrating  A policy of continuous review during the design process helps find faults early, avoiding the pain of finding them later.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 29 Summary 1  Operation specifications state design details about operations, including their Class or module Signature Description Behavior Implementation  Behavior can be specified declaratively or procedurally.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 30 Summary 2  Declarative specification is done using operation contracts stated in assertions. Preconditions state caller obligations and called operation rights. Postconditions state caller rights and called operation obligations.  Algorithms are specified in minispecs, often in pseudocode.  Data structures are specified using data structure diagrams.

© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 31 Summary 3  Design finalization is the last step of engineering design.  The design document is checked in a critical review to ensure that it has all the requisite quality characteristics.  A critical review that finds many defects can be a disaster that can be mitigated by conducting continuous reviews throughout the engineering design process.