Presentation is loading. Please wait.

Presentation is loading. Please wait.

These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.

Similar presentations


Presentation on theme: "These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by."— Presentation transcript:

1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 11 Component-Level Design Software Engineering: A Practitioner’s Approach, 6/e Chapter 11 Component-Level Design copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc. For University Use Only May be reproduced ONLY for student use at the university level when used in conjunction with Software Engineering: A Practitioner's Approach. Any other reproduction or use is expressly prohibited.

2 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 2 What is a Component? OMG Unified Modeling Language Specification [OMG01] defines a component as OMG Unified Modeling Language Specification [OMG01] defines a component as “… a modular, modular, deployable, and deployable, and replaceable replaceable part of a system that encapsulates implementation and encapsulates implementation and exposes a set of interfaces.” exposes a set of interfaces.”

3 OO view: OO view: a component contains a set of collaborating classes a component contains a set of collaborating classes Conventional view: functional element of a program Conventional view: functional element of a program Processing logic, Processing logic, the internal data, the internal data, an interface that enables the component to be invoked and data to be passed to it. an interface that enables the component to be invoked and data to be passed to it. Component-based (Process-related) view: Component-based (Process-related) view: Reusable, off-the-shelf (existing) components Reusable, off-the-shelf (existing) components A complete description of A complete description of their interface: communication and collaboration they require, their interface: communication and collaboration they require, function they perform function they perform These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 3

4 4 OO Component

5 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 5 Conventional Component

6 6 Basic Design Principles The Open-Closed Principle (OCP). The Open-Closed Principle (OCP). “A module [component] should be open for extension but closed for modification. “A module [component] should be open for extension but closed for modification. Extensible within the functional domain it addresses without the need to make internal (code or logic-level) modifications. Extensible within the functional domain it addresses without the need to make internal (code or logic-level) modifications. There shall be an abstraction between the design class and the functionality that is likely to be extended. There shall be an abstraction between the design class and the functionality that is likely to be extended. Example: Example: A Detector class that must check the status of each type of security sensor. A Detector class that must check the status of each type of security sensor. Instead of an if-then-else, we put a “sensor interface” as a consistent view of sensors to Detector Instead of an if-then-else, we put a “sensor interface” as a consistent view of sensors to Detector A new type of sensor can be added with no change to Detector class A new type of sensor can be added with no change to Detector class

7 Basic Design Principles The Liskov Substitution Principle (LSP). The Liskov Substitution Principle (LSP). “Subclasses should be substitutable for their base classes. “Subclasses should be substitutable for their base classes. Any derived class must honor any contract between the base class and the components that use it Any derived class must honor any contract between the base class and the components that use it Contract: Contract: Precondition that must be true before a component uses a base class Precondition that must be true before a component uses a base class Post-condition that should be true after the component uses a base class Post-condition that should be true after the component uses a base class These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 7

8 Basic Design Principles Dependency Inversion Principle (DIP). Dependency Inversion Principle (DIP). “Depend on abstractions. Do not depend on concretions.” “Depend on abstractions. Do not depend on concretions.” Abstractions are the place where a design can be extended without great complication Abstractions are the place where a design can be extended without great complication Depend on abstractions (like interfaces) rather than concrete components Depend on abstractions (like interfaces) rather than concrete components The Interface Segregation (isolation) Principle (ISP). “Many client-specific interfaces are better than one general purpose interface. The Interface Segregation (isolation) Principle (ISP). “Many client-specific interfaces are better than one general purpose interface. Specialized interfaces for each major category of clients Specialized interfaces for each major category of clients Interface for a client: only operations useful for that client Interface for a client: only operations useful for that client Operations used by many, shall be specified in each interface. Operations used by many, shall be specified in each interface. 8

9 Packaging Principles The Release Reuse Equivalency Principle (REP). “The granule of reuse is the granule of release.” The Release Reuse Equivalency Principle (REP). “The granule of reuse is the granule of release.” Guaranteed by a release control system Guaranteed by a release control system The Common Closure Principle (CCP). “Classes that change together belong together.” The Common Closure Principle (CCP). “Classes that change together belong together.” Packaged cohesively Packaged cohesively The Common Reuse Principle (CRP). “Classes that aren’t reused together should not be grouped together.” The Common Reuse Principle (CRP). “Classes that aren’t reused together should not be grouped together.” One may change while the others are not changed, an unnecessary test and integration will occur These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 9

10 10 Design Guidelines Components Components Naming conventions should be established for components Naming conventions should be established for components specified as part of the architectural model specified as part of the architectural model names from problem domain names from problem domain and then refined and elaborated as part of the component- level model and then refined and elaborated as part of the component- level model Implementation-specific names Implementation-specific names Interfaces Interfaces Interfaces provide important information about communication and collaboration (as well as helping us to achieve the OCP) Interfaces provide important information about communication and collaboration (as well as helping us to achieve the OCP) Dependencies and Inheritance Dependencies and Inheritance it is a good idea to model dependencies from left to right and it is a good idea to model dependencies from left to right and inheritance from bottom (derived classes) to top (base classes). inheritance from bottom (derived classes) to top (base classes).

11 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 11Cohesion Conventional view: Conventional view: the “single-mindedness” of a module the “single-mindedness” of a module OO view: OO view: cohesion implies that a component or class encapsulates only attributes and operations that are closely related to one another and to the class or component itself cohesion implies that a component or class encapsulates only attributes and operations that are closely related to one another and to the class or component itself Levels of cohesion Levels of cohesion Functional Functional Layer Layer Communicational Communicational Sequential Sequential Procedural Procedural Temporal Temporal utility utility

12 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 12Coupling Conventional view: Conventional view: The degree to which a component is connected to other components and to the external world The degree to which a component is connected to other components and to the external world OO view: OO view: a qualitative measure of the degree to which classes are connected to one another a qualitative measure of the degree to which classes are connected to one another Level of coupling Level of coupling Content Content Common Common Control Control Stamp Stamp Data Data Routine call Routine call Type use Type use Inclusion or import Inclusion or import External External

13 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 13 Component Level Design-I Step 1. Identify all design classes that correspond to the problem domain. Step 1. Identify all design classes that correspond to the problem domain. Step 2. Identify all design classes that correspond to the infrastructure domain. Step 2. Identify all design classes that correspond to the infrastructure domain. Step 3. Elaborate all design classes that are not acquired as reusable components. Step 3. Elaborate all design classes that are not acquired as reusable components. Step 3a. Specify message details when classes or component collaborate. Step 3a. Specify message details when classes or component collaborate. Step 3b. Identify appropriate interfaces for each component. Step 3b. Identify appropriate interfaces for each component.

14 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 14 Component-Level Design-II Step 3c. Elaborate attributes and define data types and data structures required to implement them. Step 3c. Elaborate attributes and define data types and data structures required to implement them. Step 3d. Describe processing flow within each operation in detail. Step 3d. Describe processing flow within each operation in detail. Step 4. Describe persistent data sources (databases and files) and identify the classes required to manage them. Step 4. Describe persistent data sources (databases and files) and identify the classes required to manage them. Step 5. Develop and elaborate behavioral representations for a class or component. Step 5. Develop and elaborate behavioral representations for a class or component. Step 6. Elaborate deployment diagrams to provide additional implementation detail. Step 6. Elaborate deployment diagrams to provide additional implementation detail. Step 7. Factor every component-level design representation and always consider alternatives. Step 7. Factor every component-level design representation and always consider alternatives.

15 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 15 Collaboration Diagram

16 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 16 Refactoring

17 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 17 Activity Diagram

18 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 18Statechart

19 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 19 Algorithm Design the closest design activity to coding the closest design activity to coding the approach: the approach: review the design description for the component review the design description for the component use stepwise refinement to develop algorithm use stepwise refinement to develop algorithm use structured programming to implement procedural logic use structured programming to implement procedural logic use ‘formal methods’ to prove logic use ‘formal methods’ to prove logic

20 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 20 Stepwise Refinement open walk to door; reach for knob; open door; walk through; close door. repeat until door opens turn knob clockwise; if knob doesn't turn, then take key out; take key out; find correct key; find correct key; insert in lock; insert in lock; endif pull/push door move out of way; end repeat

21 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 21 Algorithm Design Model represents the algorithm at a level of detail that can be reviewed for quality represents the algorithm at a level of detail that can be reviewed for quality options: options: graphical (e.g. flowchart, box diagram) graphical (e.g. flowchart, box diagram) pseudocode (e.g., PDL)... choice of many pseudocode (e.g., PDL)... choice of many programming language programming language decision table decision table conduct walkthrough to assess quality conduct walkthrough to assess quality

22 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 22 Structured Programming for Procedural Design uses a limited set of logical constructs: sequence conditional — if-then-else, select-case — if-then-else, select-case loops — do-while, repeat until — do-while, repeat until leads to more readable, testable code important for achieving high quality, but not enough can be used in conjunction with ‘proof of correctness’

23 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 23 A Structured Procedural Design

24 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 24 Decision Table

25 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001, 2005 25 Program Design Language (PDL)


Download ppt "These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by."

Similar presentations


Ads by Google