Software Engineering Design Guidelines and Patterns - Prof. Bojan Cukic, Study notes of Software Engineering

Guidelines and patterns for creating effective designs in software engineering. It covers topics such as architectural styles, data structures, design patterns, and modular design. The document also emphasizes the importance of information hiding, encapsulation, and inheritance in achieving high-quality software.

Typology: Study notes

Pre 2010

Uploaded on 07/30/2009

koofers-user-pxs
koofers-user-pxs 🇺🇸

9 documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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
Software Engineering: A Practitioner
s Approach, 6/e
s Approach, 6/e
WVU LDCSEE
WVU LDCSEE
CS 430
CS 430
Fall 2004
Fall 2004
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.
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
Analysis Model
Analysis Model -
-> Design Model
> Design Model
Analysis Model
use-cases - text
use-case diagrams
activity diagrams
swim lane diagrams
data flow diagrams
control-flow diagrams
processing narratives
flow-oriented
elements
behavioral
elements
class- based
elements
scenario-based
elements
class diagrams
analysis packages
CRC models
collaboration diagrams
state diagr ams
sequence diagrams Data/ Class Design
Architectural Design
Interface Design
Component-
Level Design
Design Model
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
Design and Quality
Design and Quality
the design must implement all of the explicit
the design must implement all of the explicit
requirements
requirements contained in the analysis model, and it
contained in the analysis model, and it
must accommodate all of the implicit requirements
must accommodate all of the implicit requirements
desired by the customer.
desired by the customer.
the design must be a readable, understandable guide
the design must be a readable, understandable guide for
for
those who generate code and for those who test and
those who generate code and for those who test and
subsequently support the software.
subsequently support the software.
the design should provide a complete picture of the
the design should provide a complete picture of the
software
software, addressing the data, functional, and behavioral
, addressing the data, functional, and behavioral
domains from an implementation perspective.
domains from an implementation perspective.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Software Engineering Design Guidelines and Patterns - Prof. Bojan Cukic and more Study notes Software Engineering in PDF only on Docsity!

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 PractitionerSoftware Engineering: A Practitioner’’s Approach, 6/es Approach, 6/e

WVU LDCSEEWVU LDCSEE

CS 430CS 430

Fall 2004Fall 2004

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.

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

Analysis ModelAnalysis Model --> Design Model> Design Model

Analysis Model

use-cases - text use-case diagramsactivity diagrams swim lane diagrams

data flow diagrams control-flow diagramsprocessing narratives

f l ow- o r i e nt e de l e m e nt s

c l a ss- ba se d b e ha v i or a le l e m e nt s e l e m e nt s

sc e na r i o- ba se de l e m e nt s

class diagramsanalysis packages CRcollaboration diagramsC models

state diagrams sequence diagrams D a t a / Cl a ss D e si g n

A r c h it e c t u r a l D e si g n

I n t e r f a c e D e si g n

Co m p o n e n t - L e v e l D e si g n

Design Model

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

Design and QualityDesign and Quality

„ „ the design must implement all of the explicitthe design must implement all of the explicit

requirementsrequirements contained in the analysis model, and itcontained in the analysis model, and it

must accommodate all of the implicit requirementsmust accommodate all of the implicit requirements

desired by the customer.desired by the customer.

„ „ the design must be a readable, understandable guidethe design must be a readable, understandable guide forfor

those who generate code and for those who test andthose who generate code and for those who test and

subsequently support the software.subsequently support the software.

„ „ the design should provide a complete picture of thethe design should provide a complete picture of the

softwaresoftware, addressing the data, functional, and behavioral, addressing the data, functional, and behavioral

domains from an implementation perspective.domains from an implementation perspective.

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 4

Quality GuidelinesQuality Guidelines

„„ A design should exhibit an architecture that (1) has been created using recognizableA design should exhibit an architecturethat (1) has been created using recognizable architectural styles or patterns, (2) is composed of components that exhibit goodarchitectural styles or patterns, (2) is composed of componentsthat exhibit good design characteristics and (3) can be implemented in an evolutionary fashiondesign characteristics and (3) can be implemented in an evolutionary fashion „„ For smaller systems, design can sometimes be developed linearlyFor smaller systems, design can sometimes be developed linearly.. „„^ A design should be modular; that is, the software should be logically partitioned intoA design should be modular; that is, the software should be logically partitioned into elements or subsystemselements or subsystems „„ A design should contain distinct representations of data, architecture, interfaces, andA design should contain distinct representationsof data, architecture, interfaces, and components.components. „„ A design should lead to data structures that are appropriate for the classes to beA design should lead to data structures that are appropriatefor the classes to be implemented and are drawn from recognizable data patterns.implemented and are drawn from recognizable data patterns. „„ A design should lead to components that exhibit independent functionalA design should lead to components that exhibit independent functional characteristics.characteristics. „„ A design should lead to interfaces that reduce the complexity of connections betweenA design should lead to interfaces that reduce the complexityof connections between components and with the external environment.components and with the external environment. „„ A design should be derived using a repeatable method that is driven by informationA design should be derived using a repeatable methodthat is driven by information obtained during software requirements analysis.obtained during software requirements analysis. „„ A design should be represented using a notation that effectively communicates itsA design should be represented using a notation that effectivelycommunicates its meaning.meaning.

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

Design PrinciplesDesign Principles

„„^ The design process should not suffer fromThe design process should not suffer from ‘‘tunnel vision.tunnel vision.’’ „„ The design should be traceable to the analysis model.The design should be traceable to the analysis model. „„ The design should not reinvent the wheel.The design should not reinvent the wheel. „„ The design shouldThe design should ““minimize the intellectual distanceminimize the intellectual distance”” [DAV95] between[DAV95] between the software and the problem as it exists in the real world.the software and the problem as it exists in the real world. „„ The design should exhibit uniformity and integration.The design should exhibit uniformity and integration. „„ The design should be structured to accommodate change.The design should be structured to accommodate change. „„ The design should be structured to degrade gently, even when abeThe design should be structured to degrade gently, even when aberrantrrant data, events, or operating conditions are encountered.data, events, or operating conditions are encountered. „„ Design is not coding, coding is not design.Design is not coding, coding is not design. „„ The design should be assessed for quality as it is being createdThe design should be assessed for quality as it is being created, not after, not after the fact.the fact. „„ The design should be reviewed to minimize conceptual (semantic)The design should be reviewed to minimize conceptual (semantic) errors.errors. From Davis [DAV95]

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

Fundamental Concepts Fundamental Concepts

„„ abstractionabstraction——data, procedure, controldata, procedure, control

„„^ architecturearchitecture——the overall structure of the softwarethe overall structure of the software

„„ patternspatterns——””conveys the essenceconveys the essence”” of a proven design solutionof a proven design solution

„„ modularitymodularity——compartmentalization of data and functioncompartmentalization of data and function

„„ hidinghiding——controlled interfacescontrolled interfaces

„„ Functional independenceFunctional independence——singlesingle--minded function and low couplingminded function and low coupling

„„ refinementrefinement——elaboration of detail for all abstractionselaboration of detail for all abstractions

„„ RefactoringRefactoring——a reorganization technique that simplifies the designa reorganization technique that simplifies the design

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 10

Patterns Patterns

Design Pattern TemplateDesign Pattern Template

Pattern namePattern name ——describes the essence of the pattern in a short but expressive ndescribes the essence of the pattern in a short but expressive nameame IntentIntent ——describes the pattern and what it doesdescribes the pattern and what it does AlsoAlso--knownknown--asas ——lists any synonyms for the patternlists any synonyms for the pattern MotivationMotivation ——provides an example of the problemprovides an example of the problem ApplicabilityApplicability ——notes specific design situations in which the pattern is applicanotes specific design situations in which the pattern is applicableble StructureStructure ——describes the classes that are required to implement the patterndescribes the classes that are required to implement the pattern ParticipantsParticipants ——describes the responsibilities of the classes that are requireddescribes the responsibilities of the classes that are required toto implement the patternimplement the pattern CollaborationsCollaborations ——describes how the participants collaborate to carry out theirdescribes how the participants collaborate to carry out their responsibilitiesresponsibilities ConsequencesConsequences ——describes thedescribes the ““design forcesdesign forces”” that affect the pattern and thethat affect the pattern and the potential tradepotential trade--offs that must be considered when the pattern is implementedoffs that must be considered when the pattern is implemented Related patternsRelated patterns ——crosscross--references related design patternsreferences related design patterns

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 11

Modular Design Modular Design

easier to build, easier to change, easier to fix ...

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

Modularity: TradeModularity: Trade--offsoffs

What is the "right" number of modulesWhat is the "right" number of modules

for a specific software design?for a specific software design?

optimal number optimal number of modulesof modules

cost ofcost of softwaresoftware

number of modulesnumber of modules

modulemodule integrationintegration costcost

module development costmodule development cost

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

Information HidingInformation Hiding

modulemodule

controlledcontrolled

interfaceinterface

"secret""secret"

**- • algorithmalgorithm

  • • data structuredata structure
  • • details of external interfacedetails of external interface
  • • resource allocation policyresource allocation policy**

clientsclients

a specific design decisiona specific design decision

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

Why Information Hiding? Why Information Hiding?

„ „ reduces the likelihood ofreduces the likelihood of ““side effectsside effects””

„ „ limits the global impact of local designlimits the global impact of local design

decisionsdecisions

„ „ emphasizes communication throughemphasizes communication through

controlled interfacescontrolled interfaces

„ „ discourages the use of global datadiscourages the use of global data

„ „ leads to encapsulationleads to encapsulation——an attribute ofan attribute of

high quality designhigh quality design

„ „ results in higher quality softwareresults in higher quality software

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

Stepwise Refinement 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;

find correct key;

insert in lock;

endif

pull/push door

move out of way;

end repeat

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

OO Design Concepts OO Design Concepts

„ „ Design classesDesign classes

„„ Entity classesEntity classes „„ Boundary classesBoundary classes „„ Controller classesController classes

„ „ InheritanceInheritance——all responsibilities of a superclass isall responsibilities of a superclass is

immediately inherited by all subclassesimmediately inherited by all subclasses

„ „ MessagesMessages——stimulate some behavior to occur in thestimulate some behavior to occur in the

receiving objectreceiving object

„ „ PolymorphismPolymorphism——a characteristic that greatly reduces thea characteristic that greatly reduces the

effort required to extend the designeffort required to extend the design

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

Design Classes Design Classes

„„ Analysis classes are refined during design to becomeAnalysis classes are refined during design to become entityentity

classesclasses

„„ Boundary classesBoundary classes are developed during design to create theare developed during design to create the

interface (e.g., interactive screen or printed reports) that theinterface (e.g., interactive screen or printed reports) that the useruser

sees and interacts with as the software is used.sees and interacts with as the software is used.

„„ Boundary classes are designed with the responsibility of managinBoundary classes are designed with the responsibility of managingg the way entity objects are represented to users.the way entity objects are represented to users.

„„ Controller classeController classe ss are designed to manageare designed to manage

„„ the creation or update of entity objects;the creation or update of entity objects; „„ the instantiation of boundary objects as they obtain informatiothe instantiation of boundary objects as they obtain information fromn from entity objects;entity objects; „„ complex communication between sets of objects;complex communication between sets of objects; „„ validation of data communicated between objects or between thevalidation of data communicated between objects or between the user and the application.user and the application.

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

InheritanceInheritance

„ „ Design options:Design options:

„„ The class can be designed and built from scratch. That is,The class can be designed and built from scratch. That is,

inheritance is not used.inheritance is not used.

„„ The class hierarchy can be searched to determine if a classThe class hierarchy can be searched to determine if a class

higher in the hierarchy (a superclass)contains most of thehigher in the hierarchy (a superclass)contains most of the

required attributes and operations. The new class inherits fromrequired attributes and operations. The new class inherits from

the superclass and additions may then be added, as required.the superclass and additions may then be added, as required.

„„ The class hierarchy can be restructured so that the requiredThe class hierarchy can be restructured so that the required

attributes and operations can be inherited by the new class.attributes and operations can be inherited by the new class.

„„ Characteristics of an existing class can be overridden andCharacteristics of an existing class can be overridden and

different versions of attributes or operations are implemented fdifferent versions of attributes or operations are implemented foror

the new class.the new 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 22

MessagesMessages

:SenderObject

:ReceiverObject

message ()

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

PolymorphismPolymorphism

case ofcase of graphtypegraphtype:: ifif graphtypegraphtype == linegraphlinegraph thenthen DrawLineGraphDrawLineGraph (data);(data); ifif graphtypegraphtype == piechartpiechart thenthen DrawPieChartDrawPieChart (data);(data); ifif graphtypegraphtype = histogram then= histogram then DrawHistoDrawHisto (data);(data); ifif graphtypegraphtype == kiviatkiviat thenthen DrawKiviatDrawKiviat (data);(data); end case;end case;

All of the graphs become subclasses of a general class called grAll of the graphs become subclasses of a general class called graph.aph.

Using a concept called overloading [TAY90], each subclass defineUsing a concept called overloading [TAY90], each subclass defines ans an

operation calledoperation called^ drawdraw. An object can send a. An object can send a^ drawdraw^ message to any onemessage to any one

of the objects instantiated from any one of the subclasses. Theof the objects instantiated from any one of the subclasses. The objectobject

receiving the message will invoke its ownreceiving the message will invoke its own drawdraw operation to create theoperation to create the

appropriate graph.appropriate graph.

graphtype drawgraphtypedraw

ConventionalConventional approachapproach ……

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

The Design ModelThe Design Model

process dimension

archit ect ure element s

int erface element s

component -level element s

deployment -level element s

low

high

class diagrams analysis packages CRC models collabor at ion diagrams

use- cases - t ext use- case diagr ams act ivit y diagr ams sw im lane diagr ams collabor at ion diagr ams (^) dat a f low diagr ams cont r ol- f low diagrams pr ocessing nar r at ives

dat a f low diagramscont r ol- f low diagr ams processing nar r at ives st at e diagr ams sequence diagr ams

st at e diagr ams sequence diagr ams

design class r ealizat ionssubsyst ems collabor at ion diagrams

design class realizat ions subsyst ems collabor at ion diagr ams

ref inement s t o:

deployment diagr ams

class diagr ams analysis packages CRC models collabor at ion diagr ams

component diagr ams design classes act ivit y diagrams sequence diagr ams r ef inement s t o: component diagr amsdesign classes act ivit y diagrams sequence diagr ams

design class r ealizat ions subsyst ems collaborat ion diagr ams component diagrams design classes act ivit y diagr ams sequence diagr ams

a na ly sis m ode l

de sign m ode l

Requirement s: const raint s int eroperabilit y t arget s and conf igurat ion

t echnical int er f ace design Navigat ion design GUI design

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 28

Deployment Elements Deployment Elements

Figure 9. 8 UML deploy m ent diagram f or SafeHom e

Per sonal comput er

Security

homeManagement

Surveillance

communication

Cont rol Panel CPI serv er Security (^) homeownerAccess

externalAccess

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 29

Design Patterns Design Patterns

„ „ The best designers in any field have an uncanny ability to see pThe best designers in any field have an uncanny ability to see patterns thatatterns that

characterize a problem and corresponding patterns that can be cocharacterize a problem and corresponding patterns that can be combined tombined to

create a solutioncreate a solution

„ „ A description of a design pattern may also consider a set of desA description of a design pattern may also consider a set of design forces.ign forces.

„„ Design forcesDesign forces describe nondescribe non--functional requirements (e.g., ease of maintainability,functional requirements (e.g., ease of maintainability, portability) associated the software for which the pattern is toportability) associated the software for which the pattern is to be applied.be applied.

„ „ TheThe pattern characteristicspattern characteristics (classes, responsibilities, and collaborations)(classes, responsibilities, and collaborations)

indicate the attributes of the design that may be adjusted to enindicate the attributes of the design that may be adjusted to enable theable the

pattern to accommodate a variety of problems.pattern to accommodate a variety of problems.

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

FrameworksFrameworks

„ „ AA frameworkframework is not an architectural pattern, but rather ais not an architectural pattern, but rather a

skeleton with a collection ofskeleton with a collection of ““plug pointsplug points”” (also called(also called

hookshooks andand slotsslots ) that enable it to be adapted to a specific) that enable it to be adapted to a specific

problem domain.problem domain.

„ „ Gamma et al note that:Gamma et al note that:

„„ Design patterns are more abstract than frameworks.Design patterns are more abstract than frameworks.

„„ Design patterns are smaller architectural elements thanDesign patterns are smaller architectural elements than

frameworksframeworks

„„^ Design patterns are less specialized than frameworksDesign patterns are less specialized than frameworks