Chapter 4 Design Principles I Correctness and Robustness

Slides:



Advertisements
Similar presentations
Object Oriented Programming
Advertisements

Making the System Operational
COMP 121 Week 9: AbstractList and ArrayList. Objectives List common operations and properties of Lists as distinct from Collections Extend the AbstractCollection.
Chapter 13 – Introduction to Classes
 Both System.out and System.err are streams—a sequence of bytes.  System.out (the standard output stream) displays output  System.err (the standard.
Programming Logic and Design Fourth Edition, Introductory
Requirements and Design
Basic Concepts in Component-Based Software Engineering
OASIS Reference Model for Service Oriented Architecture 1.0
Chapter 1 The Systems Development Environment
Fall 2007CS 225 Introduction to Software Design Chapter 1.
What is an object? Your dog, your desk, your television set, your bicycle. Real-world objects share two characteristics: They all have state and behavior;
THE OBJECT-ORIENTED DESIGN WORKFLOW Interfaces & Subsystems.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
The Process of Interaction Design. What is Interaction Design? It is a process: — a goal-directed problem solving activity informed by intended use, target.
Design 15 February. Software Engineering: Elaborated Steps Concept (contract, intro on web site) Requirements (use cases, requirements) Architecture Design.
Overview of Software Requirements
Chapter 1 Principles of Programming and Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
1 Case Study: Starting the Student Registration System Chapter 3.
“GENERIC SCRIPT” Everything can be automated, even automation process itself. “GENERIC SCRIPT” Everything can be automated, even automation process itself.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
The Design Discipline.
Dr. Ken Hoganson, © August 2014 Programming in R STAT8030 Programming in R COURSE NOTES 1: Hoganson Programming Languages.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture # 05: Design Principles I - Correctness and Robustness SWE 316: Software.
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
Chapter 2 Object Orientation. Process Phase Affected by This Chapter Requirements Analysis Design Implementation ArchitectureFrameworkDetailed Design.
Rational Unified Process (Part 1) CS3300 Fall 2015.
Prologue: The Software Process. Main Phases of Software Process 1. Requirements Analysis (answers “WHAT?”) Specifying what the application must do 2.
Chapter 5 Design Principles II: Flexibility, Reusability, and Efficiency.
Lecture # 06 Design Principles II
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
Chapter 5 Design Principles II: Flexibility, Reusability, and Efficiency.
Output and User Interface Design
Comp2110 Software Design lecture 13Detailed Design (1)  detailed design contrasted with high level design  introducing the Observer Design Pattern 
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 7 Requirements and Domain Classes SWE 316: Software Design and Architecture.
CS212: Object Oriented Analysis and Design Lecture 4: Objects and Classes - I.
2/6/01D-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Using PARTS to Illustrate Requirements Concepts.
Chapters 4&5 Design Principles: Correctness, Robustness, Flexibility, Reusability, and Efficiency.
Software Engineering Modern Approaches Eric Braude and Michael Bernstein 1.
SWE 619 © Paul Ammann Procedural Abstraction and Design by Contract Paul Ammann Information & Software Engineering SWE 619 Software Construction cs.gmu.edu/~pammann/
Exceptions Handling Exceptionally Sticky Problems.
1 Introduction to Software Engineering Lecture 1.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Chapter 1 Introduction to Databases. 1-2 Chapter Outline   Common uses of database systems   Meaning of basic terms   Database Applications  
SWE 316: Software Design and Architecture Objectives Lecture # 18 Introduction to Components SWE 316: Software Design and Architecture To learn:  benefits.
Today’s Agenda  Reminder: HW #1 Due next class  Quick Review  Input Space Partitioning Software Testing and Maintenance 1.
CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University.
Chapter 6 Introduction to Design Patterns. Process Phase Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFrameworkDetailed.
Copyright  2002 Urbancode Software Development, Inc. All Rights Reserved. Developing with JAAS Presented by Maciej Zawadzki
Chapter 1 Programming Review and Introduction to Software Design.
Chapter 4 Design Principles I Correctness and Robustness.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 13 Creational Design Pattern SWE 316: Software Design and Architecture.
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.
CSE 303 – Software Design and Architecture
© 2010 John Wiley & Sons Ltd. Software Engineering Modern Approaches Eric Braude and Michael Bernstein 1.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Chapters 10, 11 SSD (Revision) SD DCD Exam Object-Oriented Design.
Chapter 7 Creational Design Pattern. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFrameworkDetailed.
Basic Concepts and Definitions
A FIRST BOOK OF C++ CHAPTER 14 THE STRING CLASS AND EXCEPTION HANDLING.
T EST T OOLS U NIT VI This unit contains the overview of the test tools. Also prerequisites for applying these tools, tools selection and implementation.
Handling Exceptionally Sticky Problems
COMP2110 Software Design in 2004 lecture 09 High level design
Handling Exceptionally Sticky Problems
Presentation transcript:

Chapter 4 Design Principles I Correctness and Robustness

Process Phase Affected by This Chapter Requirements Analysis Process Phase Affected by This Chapter Design Framework Architecture Detailed Design Implementation Key: = less affected Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Key Concept:  Correctness  Goal: That each artifact satisfies designated requirements, and that together they satisfy all of the application’s requirements. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Sufficient Designs: Terminology and Rationale A design sufficient to implement the requirements. Minimum goal: a correct design Sometimes called … It follows that … the design must be entirely understandable A common way to achieve this is to make … the design very modular Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Key Concept:  Correctness by Informal Methods  Simplify and modularize designs until they convince. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Invariants for Class Automobile -- with variables mileage, VehicleID, value, originalPrice, and type:  mileage > 0 mileage < 1000000 vehicleID has at least 8 characters value >= -300 ($300 is the disposal cost of a worthless automobile) originalPrice >= 0 ( type == “REGULAR” && value <= originalPrice ) || ( type == “VINTAGE” && value >= originalPrice ) Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Introducing Interfaces 1 of 2 Shipment setVehicle() perishable() getWidth() printRoute() describeType() getLength() getDuration() setType() Introducing Interfaces 1 of 2 Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Introducing Interfaces 2 of 2 Dimensions getWidth() getLength() getWeight() TransportationMeans getDuration() setVehicle() printRoute() GoodsType describeType() setType() perishable() Original form Shipment setVehicle() perishable() getWidth() printRoute() describeType() getLength() getDuration() setType() Shipment Forms using interfaces Dimensions Shipment TransportationMeans GoodsType Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Package Interfaces purchases Pricing Furniture PurchasesIF Clothing «singleton» PurchasesIF Clothing Selection Appliance ClothingTryout Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Example of Package Interfaces chatServer Conversation Conversation- services ConversationManager Participant- services chatClient ServerComm Display Message- reception billing ClientComm Accounting Bill Financial Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Key Concept:  Interfaces  -- collections of function prototypes: Make designs more understandable. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Domain vs. Non-Domain Classes Domain classes: Particular to the application Examples: BankCustomer, BankTransaction, Teller Typically not GUI classes Sufficient to classify all requirements (see chapter xx) Non-Domain classes: Generic Examples: abstract classes, utility classes Arise from design and implementation considerations Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Alternative Modularizations Application tracking trajectory of rocket carrying orbit-bound satellite into position Alternative Modularizations Alternative 1 mechanics Alternative 2 control position trajectory ground control onBoardNavigation weather Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Improving Robustness: Sources of Errors Protection from faulty Input User input Input, not from user Data communication Function calls made by other applications Protection from developer error Faulty design Faulty implementation Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Constraints on Parameters Example: int computeArea( int aLength, int aBreadth ) { … } Capture parameter constraints in classes if feasible int computeArea( RectangleDimension a RectangleDimension ) Specify all parameter constraints in method comments aLength > 0 and aBreadth > 0 and aLength >= aBreadth Callers obey explicit requirements on parameters Problem is method programmers have no control over callers Check constraints first within the method code if( aLength <= 0 ) …… Throw exception if this is a predictable occurrence Otherwise abort if possible Otherwise return default if it makes sense in context And generate warning or log to a file Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Key Concept:  Robustness  -- is promoted by verifying data values before using them. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Replace int computeArea( int aLength, int aBreadth ) {..} Wrapping Parameters Replace int computeArea( int aLength, int aBreadth ) {..} with int computeArea( Rectangle aRectangle ) -- where class Rectangle { … Rectangle( int aLength, int aBreadth ) { if( aLength > 0 ) this.length = aLength; else ….. } … } Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Key Concept:  Robustness  -- is promoted by enforcing intentions. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

How Much Design Detail Before Initial Coding? 100% Inexperienced designer Recommen-ded % of design detail before starting to code Diminishing ability of designer to envisage consequences of design decision. Experienced designer 0% Very simple Type of application Very complex Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Summary of This Chapter Correctness of a Design or Code Supports the requirements In general, many correct designs exist Robustness of a Design or Code Absorbs errors -- of the user -- of developers Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Video Store Application: Sufficient Classes? CheckOutDurationDisplay Customer CheckOutDisplay BarCodeReader RegisterNewVideoDisplay Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.