Chapter 5 Design Principles II: Flexibility, Reusability, and Efficiency.

Slides:



Advertisements
Similar presentations
Chapter 6 Introduction to Design Patterns. Sample Design Goals and Ways to Accomplish Them Reusability, Flexibility, and Efficiency o Reuse flexible designs.
Advertisements

Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Object-Oriented Software Development CS 3331 Fall 2009.
Matt Klein. Decorator Pattern  Intent  Attach Additional responsibilities to an object by dynamically. Decorators provide a flexible alternative to.
Presented by: Thabet Kacem Spring Outline Contributions Introduction Proposed Approach Related Work Reconception of ADLs XTEAM Tool Chain Discussion.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
Software Reuse Building software from reusable components Objectives
Design Patterns CS is not simply about programming
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Chapter 6. 2 Objectives You should be able to describe: Function and Parameter Declarations Returning a Single Value Pass by Reference Variable Scope.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Design Patterns.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 22 Object-Oriented Design
20 February Detailed Design Implementation. Software Engineering Elaborated Steps Concept Requirements Architecture Design Implementation Unit test Integration.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
DATA STRUCTURE Subject Code -14B11CI211.
6/1/2001 Supplementing Aleph Reports Using The Crystal Reports Web Component Server Presented by Bob Gerrity Head.
Chapter 4 Design Principles I Correctness and Robustness
Design Patterns.
Chapter 10 Introduction to Components. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFramework Detailed.
Chapter 2 Object Orientation. Process Phase Affected by This Chapter Requirements Analysis Design Implementation ArchitectureFrameworkDetailed Design.
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.
An Introduction to Software Architecture
Software Engineering Chapter 8 Fall Analysis Extension of use cases, use cases are converted into a more formal description of the system.Extension.
Comp2110 Software Design lecture 13Detailed Design (1)  detailed design contrasted with high level design  introducing the Observer Design Pattern 
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Chapters 4&5 Design Principles: Correctness, Robustness, Flexibility, Reusability, and Efficiency.
SWE 316: Software Design and Architecture Objectives Lecture # 15 Behavioral Design Patterns SWE 316: Software Design and Architecture  To learn the behavioral.
SOFTWARE SYSTEMS DEVELOPMENT 4: System Design. Simplified view on software product development process 2 Product Planning System Design Project Planning.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Jan. 29, 2002Grand Challenges in Simulation Issues in Enhancing Model Reuse C. Michael Overstreet Richard E. Nance Osman Balci.
GoF Sections Design Problems and Design Patterns.
SWE 316: Software Design and Architecture Objectives Lecture # 18 Introduction to Components SWE 316: Software Design and Architecture To learn:  benefits.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
Structural Design Patterns
CIS 112 Exam Review. Exam Content 100 questions valued at 1 point each 100 questions valued at 1 point each 100 points total 100 points total 10 each.
Chapter 6 Introduction to Design Patterns. Process Phase Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFrameworkDetailed.
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.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
1-1 Software Development Objectives: Discuss the goals of software development Identify various aspects of software quality Examine two development life.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Introduction to Software Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2010 John Wiley & Sons Ltd. Software Engineering Modern Approaches Eric Braude and Michael Bernstein 1.
Written by Changhyun, SON Chapter 5. Introduction to Design Optimization - 1 PART II Design Optimization.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Design Patterns: Structural Design Patterns General and reusable solutions to common problems in software design Software University
Chapter 7 Creational Design Pattern. Process Phases Discussed in This Chapter Requirements Analysis Design Implementation ArchitectureFrameworkDetailed.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th Edition Copyright © 2015 John Wiley & Sons, Inc. All rights.
Maitrayee Mukerji. INPUT MEMORY PROCESS OUTPUT DATA INFO.
COMP2110 Software Design in lecture 14 Patterns(1) /Detailed Design
TIM 58 Chapter 8: Class and Method Design
Object Oriented Design Patterns - Structural Patterns
Two Patterns in Adaptive, Distributed Real-Time, Embedded Middleware
Software Design Lecture : 9.
Object-Oriented Programming
An Introduction to Software Architecture
Authors: Barry Smyth, Mark T. Keane, Padraig Cunningham
Object-Oriented Programming
Presentation transcript:

Chapter 5 Design Principles II: Flexibility, Reusability, and Efficiency

Ch.5 – Design Principles II o Flexibility o Reusability o Efficiency o Trade-offs Among the Design Principles

5.1 Flexibility

Aspects of Flexibility  … adding more of the same kind of functionality Example (banking application): handle more kinds of accounts without having to change the existing design or code  … adding different functionality Example : add withdraw function to existing deposit functionality o … changing the overall intended functionality Example : allow overdrafts Anticipate … Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Adding More of the Same Kind: Registering Website Members Flexibly WebSite Member 0..n StandardMemberXMemberYMember members Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission. WebSite register() Member 0..nmembers Approach #1 Approach #2 (Adding Flexibility)

Adding Different Functionality: Alternative Situations Within the scope of … 1.… a list of related functions Example: add print to the set of existing air travel itinerary functions an existing base class Example: add “print road - and ship -” to air itinerary neither Example: add “print itineraries for combinations of air, road and ship transportation” Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Adding Functionality When a Base Class Exists Trip printItinerary() StandardTrip printItinerary() SomeApplicationClass Makes a method call printItinerary() Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Adding Functionality Through a Base Class Trip printItinerary() SeaTrip printItinerary() SomeApplicationClass LandTrip printItinerary() StandardTrip printItinerary() Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Additional Types of Flexibiliy Flexibility Aspect: ability to …Described in … … create objects in variable configurations determined at runtime “Creational” design patterns – chapter 7 … create variable trees of objects or other structures at runtime “Structural” design patterns – chapter 8 … change, recombine, or otherwise capture the mutual behavior of a set of objects “Behavioral” design patterns – chapter 9 … create and store a possibly complex object of a class. Component technology … configure objects of predefined complex classes – or sets of classes – so as to interact in many ways Component technology Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Key Concept:  Flexibility  We design flexibly, introducing parts, because change and reuse are likely. Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

5.2 Reusability

Making a Method Re-usable  Specify completely o Preconditions, etc  Avoid unnecessary coupling with the enclosing class o Consider making it static, if appropriate, to make it more independent of the instance variables o Include parameterization o i.e., make the method functional o But limit the number of parameters  Make the names expressive o Understandability promotes re-usability  Explain the algorithm o Re-users need to know how the algorithm works Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Making a Class Re-usable  Describe the class completely  Make the class name and functionality match a real world concept o Define a useful abstraction o Attain broad applicability  Reduce dependencies on other classes o Elevate dependencies in hierarchy alternatives Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Reducing Dependency Among Classes Customer Replace … Piano with … CustomerPianoPianoOrder Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission. Piano aggregates Customer PianoOrder aggregates Customer and Piano

Leveraging Inheritance, Aggregation and Dependency for the Re-use of Class Combinations Customer computeBill() RegularCustomer computeBill() Customer computeBill() Bill compute() Customer computeBill( Orders ) Orders value() (1) Leveraging inheritance (3) Leveraging dependency (2) Leveraging aggregation Customer computeBill() Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

5.3 Efficiency

Basic Approaches to Time Efficiency  Design for Other Criteria, Then Consider Efficiency o Design for flexibility, reusability, … o At some point, identify inefficient places o Make targeted changes to improve efficiency  Design for Efficiency From the Start o Identify key efficiency requirements up front o Design for these requirements during all phases  Combine These Two Approaches o Make trade-offs for efficiency requirements during design o Address remaining efficiency issues after initial design Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Space-Time Trade-offs Space Time to process one item Typical target Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission. Time

Space-Time-Development Trade-offs SpaceTime Ease of Development Effort Limiting acceptable value unacceptable values better than acceptable values Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Impediments to Speed Efficiency o Loops o while, for, do o Remote operations o Requiring a network o LAN o The Internet o Function calls o -- if the function called results in the above o Object creation Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Trade-off Between Number of Remote Calls and Volume Retrieved at Each Call Number of remote accesses Volume retrieved at each access Typical target Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Storage Locations Code base Runtime RAM Disk storage required at runtime Compress disk storage required between runtimes Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Attaining Storage Efficiency  Store only the data needed o Trades off storage efficiency vs. time to extract and re-integrate  Compress the data o Trades off storage efficiency vs. time to compress and decompress  Store in order of relative frequency o Trades off storage efficiency vs. time to determine location Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

5.4 Trade-Offs Among the Design Principles

Trading off Robustness, Flexibility, Efficiency and Reusability* 1A. Extreme Programming Approach (See next slide) Design for sufficiency only 1B. Flexibility-driven Approach Design for extensive future requirements Reuse usually a by-product 2. Ensure robustness 3. Provide enough efficiency Compromise re-use etc. as necessary to attain efficiency requirements - or - Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission. *Note: You don’t do trade-offs for correctness

Pros and Cons Extreme Design vs. non-Extreme Design + Job done faster (usually) + Scope clear + More likely to be efficient Future applications less likely to use the work - Refactoring for expanded requirements can be expensive + Future applications more likely to use parts + Accommodates changes in requirements Scope less clear - Potential to waste effort - Efficiency requires more special attention Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

A More Flexible Design for Calculator Application CommandLineCalculator main() executeAdditions() solicitNumberAccounts() getAnInputFromUser() interactWithUser() Existing Design New Design Calculator solicitNumAccounts() CalcDisplay display() CalcOperation execute() AddMultiplyDivide Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.

Summary of This Chapter  Flexibility o == readily changeable  Reusability o in usage by other applications  Efficiency o in time o in space (Combine these with Correctness & Robustness from Chapter 4 ) Adapted from Software Design: From Programming to Architecture by Eric J. Braude (Wiley 2003), with permission.