Detailed Design Overview and Mid-Level Class Modeling

7
Rapamycin- and Paclitaxel-Eluting Stents Rapamycin- and Paclitaxel-Eluting Stents With Identical Biodegradable Polymeric With Identical Biodegradable Polymeric Coating and Design Trial Coating and Design Trial Presented at Presented at The American College of Cardiology The American College of Cardiology Scientific Session 2006 Scientific Session 2006 Presented by Dr. Rainer Wessley Presented by Dr. Rainer Wessley

description

Detailed Design Overview and Mid-Level Class Modeling. Objectives. To present an overview of the detailed design process To survey detailed design specifications To distinguish mid-level and low-level design To present techniques for generating mid-level class designs - PowerPoint PPT Presentation

Transcript of Detailed Design Overview and Mid-Level Class Modeling

Page 1: Detailed Design Overview and Mid-Level Class Modeling

1© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Detailed Design Detailed Design Overview andOverview andMid-Level Class Mid-Level Class ModelingModeling

Page 2: Detailed Design Overview and Mid-Level Class Modeling

2© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

ObjectivesObjectives

To present an overview of the detailed design process

To survey detailed design specifications

To distinguish mid-level and low-level design

To present techniques for generating mid-level class designs

To present heuristics for mid-level class design

Page 3: Detailed Design Overview and Mid-Level Class Modeling

3© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

TopicsTopics

Scope of detailed design Mid- and low-level design Detailed design process and

specifications Mid-level design techniques

• Creational• Transformational

Mid-level design heuristics• Responsibility-driven design• Inheritance• Delegation

Page 4: Detailed Design Overview and Mid-Level Class Modeling

4© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Scope of Detailed Scope of Detailed DesignDesign

Levels of abstraction from architecture to coding

Many static and dynamic models Great bulk of design specifications Divide into two parts: mid-level and

low-level design The boundaries between detailed

design, architectural design, and programming are fuzzy.

Page 5: Detailed Design Overview and Mid-Level Class Modeling

5© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Mid-Level DesignMid-Level Design

DeSCRIPTR specification (Chapter 8) Design patterns (more on this later)

Mid-level design is the activity of specifying software at the level of

medium-sized components, such as compilation units or classes, and their

properties, relationships, and interactions.

Mid-level design is the activity of specifying software at the level of

medium-sized components, such as compilation units or classes, and their

properties, relationships, and interactions.

Page 6: Detailed Design Overview and Mid-Level Class Modeling

6© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Low-Level DesignLow-Level Design

DeSCRIPTR specifications plus PAID• Packaging—Placing code into compilation

units, libraries, packages, etc.• Algorithms—Sometimes specified• Implementation—Visibility, accessibility,

association realization, etc.• Data structures and types—Sometimes

specified

Low-level design is the activity of filling in the small details at the lowest level of

abstraction.

Low-level design is the activity of filling in the small details at the lowest level of

abstraction.

Page 7: Detailed Design Overview and Mid-Level Class Modeling

7© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Detailed Design ProcessDetailed Design Process

Detailed Design ProcessSRS, SAD : ProblemDesign Document : Solution

DesignDocument

SRS

[adequate detailed design]

Analyze SRSand SAD

Generate/Improve DetailedDesign Alternatives

Evaluate DetailedDesign Alternatives

[else]

Select DetailedDesign

Finalize Design

SAD

Page 8: Detailed Design Overview and Mid-Level Class Modeling

8© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Detailed Design Detailed Design DocumentDocument

A design document consists of a SAD (Chapter 9) and a detailed design document (DDD).

A DDD template

1. Mid-Level Design Models2. Low-Level Design Models3. Mapping Between Models4. Detailed Design Rationale5. Glossary

Page 9: Detailed Design Overview and Mid-Level Class Modeling

9© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Mid-Level Generation Mid-Level Generation TechniquesTechniques

Creational—Make a mid-level design class model from scratch

• Functional decomposition• Quality attribute decomposition• Design themes

Transformational—Change another model into a mid-level design class model

• Similar system• Patterns or architectures• Analysis model

Page 10: Detailed Design Overview and Mid-Level Class Modeling

10© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Generation from Design Generation from Design ThemesThemes

A design theme is an important problem, concern, or issue that must be addressed in a design.

Design themes can be the basis for generating a design from scratch.

Page 11: Detailed Design Overview and Mid-Level Class Modeling

11© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Design Design Theme Theme ProcessProcess

[class discovery slows]

[diagram complete]

Theme-Based DecompositionSRS : Theme SourceClass Diagram : Draft Model

ClassDiagram

SRSWrite Design

Story

Generate/ImproveCandidate Classes

[else]

Evaluate/SelectClasses

Draw/ImproveClass Diagram

Identify Themes

DesignStory

[else]

Evaluate ClassDiagram

Themes

Page 12: Detailed Design Overview and Mid-Level Class Modeling

12© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Analyzing Design Analyzing Design StoriesStories

Start by writing a design story: a short description of the application that stresses its most important aspects.

Study the design story to identify design themes.

List the themes• Functional themes• Quality attribute themes

Page 13: Detailed Design Overview and Mid-Level Class Modeling

13© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Generating Candidate Generating Candidate ClassesClasses

Brainstorm candidate classes from the themes; list classes and their responsibilities.

• Entities in charge of program tasks• Actors• Things about which the program stores data• Structures and collections

Rationalize the classes.• Discard those with murky names or

responsibilities• Rework classes with overlapping responsibilities• Discard those that do something out of scope

Page 14: Detailed Design Overview and Mid-Level Class Modeling

14© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Draft a Class DiagramDraft a Class Diagram

Draw the classes from the list. Add attributes, operations, and

associations. Refine the class diagram.

• Check classes for completeness and cohesion.

• Make super-classes where appropriate.• Apply design patterns where

appropriate.

Page 15: Detailed Design Overview and Mid-Level Class Modeling

15© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Transforming a Transforming a Conceptual ModelConceptual Model

Change actors to interface classes. Add actor domain classes. Add a startup class. Convert or add controllers and

coordinators. Add classes for data types. Convert or add container classes. Convert or add engineering design

associations.

Page 16: Detailed Design Overview and Mid-Level Class Modeling

16© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

ResponsibilitiesResponsibilities

Operational responsibilities are usually fulfilled by operations.

Data responsibilities are usually fulfilled by attributes.

Class collaborations may be involved.

A responsibility is an obligation to perform a task (an operational

responsibility) or to maintain some data (a data responsibility).

A responsibility is an obligation to perform a task (an operational

responsibility) or to maintain some data (a data responsibility).

Page 17: Detailed Design Overview and Mid-Level Class Modeling

17© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Responsibility-Driven Responsibility-Driven DecompositionDecomposition

Responsibilities may be stated at different levels of abstraction.

Responsibilities can be decomposed. High-level responsibilities can be

assigned to top-level components. Responsibility decomposition can be

the basis for decomposing components.

• Responsibilities reflect both operational and data obligations, so responsibility-driven decomposition can be different from functional decomposition.

Page 18: Detailed Design Overview and Mid-Level Class Modeling

18© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Responsibility Responsibility Heuristics 1Heuristics 1

Assigning responsibilities well helps achieve high cohesion and low coupling.

• State both operational and data responsibilities.

• Assign modules at most one operational and one data responsibility.

• Assign complementary data and operational responsibilities.

Page 19: Detailed Design Overview and Mid-Level Class Modeling

19© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Responsibility Responsibility Heuristics 2Heuristics 2

Make sure module responsibilities do not overlap.

Place operations and data in a module only if they help fulfill the module’s responsibilities.

Place all operations and data needed to fulfill a module responsibility in that module.

Page 20: Detailed Design Overview and Mid-Level Class Modeling

20© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

InheritanceInheritance

Inheritance is a declared relation between a class and one or more super-classes that causes the sub-class to have every attribute and operation of the super-class(es).

• Captures a generalization relation between classes

• Allows reuse of attributes and operation from super-classes in sub-classes

Page 21: Detailed Design Overview and Mid-Level Class Modeling

21© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Using Inheritance Using Inheritance ProperlyProperly

Don’t use inheritance only for reuse.• Confusing• Ugly• Leads to problems in the long run

Use inheritance only when there is a generalization (kind-of) relation present.

Reuse can often be achieved by rethinking the class structure.

• Clear• Elegant• Robust

Page 22: Detailed Design Overview and Mid-Level Class Modeling

22© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Inheritance ExampleInheritance Example

Scatterplot

- title- xUnits- yUnits- xLabel- yLabel- xMin- yMin- xMax- yMax- data[*]

# setUpGraph()# plotData()+ draw()

Graph

- title- xUnits- yUnits- xLabel- yLabel- xMin- yMin- xMax- yMax

# setUpGraph()# plotData()+ draw()

Scatterplot

- data[*]

# plotData()

BarChart

- numBins- bins[*]- binWidth

# plotData()

setUpGraph();plotData();

Page 23: Detailed Design Overview and Mid-Level Class Modeling

23© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

DelegationDelegation

Delegation is a tactic wherein one module (the delagator) entrusts another module (the delegate) with a responsibility.

• Allows reuse without violating inheritance constraints

• Makes software more reusable and configurable

Page 24: Detailed Design Overview and Mid-Level Class Modeling

24© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Delegation ExampleDelegation Example

Axes

- title- xUnits- yUnits- xLabel- yLabel- xMin- yMin- xMax- yMax

+ draw()

Scatterplot

- data[*]

# plotData()+ draw()

BarChart

- numBins- bins[*]- binWidth

# plotData()+ draw()

axes.draw();plotData();

- axes

- axes

Page 25: Detailed Design Overview and Mid-Level Class Modeling

25© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Inheritance and Inheritance and Delegation HeuristicsDelegation Heuristics

Use inheritance only when there is a generalization relationship between the sub-class and its super-class(es).

Combine common attributes and operations in similar classes into a common super-class.

Use delegation to increase reuse, flexibility, and configurability.

Page 26: Detailed Design Overview and Mid-Level Class Modeling

26© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Summary 1Summary 1

Detailed design is a big job that comprises the bulk of software engineering design work, so it helps to divide it into mid-level and low-level design.

Mid-level design is captured in a DDD that includes DeSCRIPTR specifications.

Mid-level class designs can be generated from scratch (creational) or by changing another model (transformational).

Page 27: Detailed Design Overview and Mid-Level Class Modeling

27© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Summary 2Summary 2

One creational techniques uses design themes extracted from a design story.

One transformational techniques is to convert a conceptual model into a design class model.

Responsibility-driven design helps designers make good decisions about class models.

Inheritance and delegation, when used properly, lead to clear and elegant designs that increase reusability, flexibility, and configurability.