3. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 33
Analysis ModelAnalysis 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
f l ow- or i e nt e d
e l e me nt s
be ha v i or a l
e l e me nt s
c l a ss- ba se d
e l e me nt s
sc e na r i o- ba se d
e l e me nt s
class diagrams
analysis packages
CRC models
collaboration diagrams
state diagrams
sequence diagrams
D a t a / Cla ss D e sign
A rc hit e c t ura l De sign
Int e rf a c e De sign
Com pone nt -
Le v e l D e sign
Design Model
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
4. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 44
Design and QualityDesign and Quality
•• the design must implement all of thethe design must implement all of the
–– explicit requirements contained in the analysisexplicit requirements contained in the analysis
model,model,
–– implicit requirements desired by the customer.implicit requirements desired by the customer.
•• the design must be a readable,the design must be a readable,
understandable guideunderstandable guide for those whofor those who
–– generate codegenerate code
–– testtest
–– support the software.support the software.
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
5. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 55
•• the design should provide a complete picture ofthe design should provide a complete picture of
the softwarethe software, addressing the data, functional,, addressing the data, functional,
and behavioral domains from an implementationand behavioral domains from an implementation
perspective.perspective.
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
6. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 66
Quality GuidelinesQuality Guidelines
•• A design should exhibit an architectureA design should exhibit an architecture
–– (1) created using recognizable architectural styles or(1) created using recognizable architectural styles or
patterns,patterns,
–– (2) composed of components with good design(2) composed of components with good design
characteristicscharacteristics
–– (3) can be implemented in an evolutionary fashion(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 modularA design should be modular;;
–– the software should be logically partitionedthe software should be logically partitioned
into elements or subsystemsinto elements or subsystems
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
7. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 77
••A design should contain distinctA design should contain distinct
representationsrepresentations of data, architecture, interfaces, andof data, architecture, interfaces, and
components.components.
••A design should lead to data structures thatA design should lead to data structures that
areare
appropriate for the classes to be implementedappropriate for the classes to be implemented
are drawn from recognizable data patternsare drawn from recognizable data patterns..
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
8. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 88
Quality Guidelines (cont.)Quality Guidelines (cont.)
•• A design should lead toA design should lead to
–– components that exhibit independentcomponents that exhibit independent
functional characteristics.functional characteristics.
•• A design should lead toA design should lead to
–– interfaces that reduce the complexityinterfaces that reduce the complexity ofof
connections between components and withconnections between components and with
the external environment.the external environment.
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
9. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 99
•• A design should be derived using a repeatableA design should be derived using a repeatable
methodmethod
that is driven by information obtained during softwarethat is driven by information obtained during software
requirements analysis.requirements analysis.
•• A design should be represented usingA design should be represented using
a notation that effectively communicates its meaning.a notation that effectively communicates its meaning.
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
10. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 1010
Fundamental ConceptsFundamental Concepts
•• abstractionabstraction——data, procedure, controldata, procedure, control
•• architecturearchitecture——the overall structure of thethe overall structure of the
softwaresoftware
•• patternspatterns——””conveys the essenceconveys the essence”” of aof a
proven design solutionproven design solution
•• modularitymodularity——compartmentalization ofcompartmentalization of
data and functiondata and function
•• Information hidingInformation hiding——controlled interfacescontrolled interfaces
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
11. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 1111
••Functional independenceFunctional independence——singlesingle--mindedminded
function and low couplingfunction and low coupling
••RefinementRefinement ——elaboration of detail for allelaboration of detail for all
abstractionsabstractions
••RefactoringRefactoring ——a reorganization techniquea reorganization technique
that simplifies the designthat simplifies the design
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
12. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 1212
Data AbstractionData Abstraction
doordoor
implemented as a data structure
manufacturermanufacturer
model numbermodel number
typetype
swing directionswing direction
insertsinserts
lightslights
typetype
numbernumber
weightweight
opening mechanismopening mechanism
Abstraction-architecture-patterns-modularity-hiding-functional independence-refinement-refactoring
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
13. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 1313
Procedural AbstractionProcedural Abstraction
openopen
implemented with a "knowledge" of the
object that is associated with enter
details of enterdetails of enter
algorithmalgorithm
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
14. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 1414
ArchitectureArchitecture
““The overall structure of the software and the ways inThe overall structure of the software and the ways in
which that structure provides conceptual integrity for awhich that structure provides conceptual integrity for a
system.system.”” [SHA95a][SHA95a]
Structural properties.Structural properties.
••Defines the components of a system (e.g., modules, objects, filtDefines the components of a system (e.g., modules, objects, filters) anders) and
••How the components are packaged and interact with one another.How the components are packaged and interact with one another.
ExtraExtra--functional properties.functional properties.
•• How the design architecture achieves requirements forHow the design architecture achieves requirements for
•• performance, capacity, reliability, security, adaptability, andperformance, capacity, reliability, security, adaptability, and otherother
system characteristics.system characteristics.
Families of related systems.Families of related systems.
•• draw upon repeatable patterns that are commonly encountered indraw upon repeatable patterns that are commonly encountered in the designthe design
of families of similar systems.of families of similar systems.
•• The design should have the ability to reuse architectural buildThe design should have the ability to reuse architectural building blocks.ing blocks.
Abstraction-architecture-patterns-modularity-hiding-functional independence-refinement-refactoring
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
15. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 1515
PatternsPatterns
Design Pattern enables a designer toDesign Pattern enables a designer to
determine whether the pattern :determine whether the pattern :
•• is applicable to the current workis applicable to the current work
•• can be reusedcan be reused
•• can serve as a guide for developing acan serve as a guide for developing a
similar, but functionally or structurallysimilar, but functionally or structurally
different pattern.different pattern.
Abstraction-architecture-patterns-modularity-hiding-functional independence-refinement-refactoring
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
16. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 1616
Modular DesignModular Design
easier to build, easier to change, easier to fix ...
Abstraction-architecture-patterns-modularity-hiding-functional independence-refinement-refactoring
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
17. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 1717
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 numberoptimal number
of modulesof modules
cost ofcost of
softwaresoftware
number of modulesnumber of modules
modulemodule
integrationintegration
costcost
module development costmodule development cost
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
18. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 1818
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
Abstraction-architecture-patterns-modularity-hiding-functional independence-refinement-refactoring
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
19. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 1919
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 through controlledemphasizes communication through controlled
interfacesinterfaces
•• discourages the use of global datadiscourages the use of global data
•• leads to encapsulationleads to encapsulation——an attribute of highan attribute of high
quality designquality design
•• results in higher quality softwareresults in higher quality software
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
20. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 2020
Functional IndependenceFunctional Independence
COHESION - the degree to which a
module performs one and only one
function.
COUPLING - the degree to which a
module is "connected" to other
modules in the system.
Abstraction-architecture-patterns-modularity-hiding-functional independence-refinement-refactoring
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
21. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 2121
Stepwise RefinementStepwise 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
Abstraction-architecture-patterns-modularity-hiding-functional independence-refinement-refactoring
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
22. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 2222
RefactoringRefactoring
•• Fowler [FOW99] definesFowler [FOW99] defines refactoringrefactoring in thein the
following manner:following manner:
–– ""RefactoringRefactoring is the process of changing a softwareis the process of changing a software
system in such a way that it does not alter the externalsystem in such a way that it does not alter the external
behavior of the code [design] yet improves its internalbehavior of the code [design] yet improves its internal
structure.structure.””
•• When software isWhen software is refactoredrefactored, the existing design is, the existing design is
examined forexamined for
–– redundancyredundancy
–– unused design elementsunused design elements
–– inefficient or unnecessary algorithmsinefficient or unnecessary algorithms
–– poorly constructed or inappropriate data structurespoorly constructed or inappropriate data structures
–– or any other design failure that can be corrected to yieldor any other design failure that can be corrected to yield
a better design.a better design.
Abstraction-architecture-patterns-modularity-hiding-functional independence-refinement-refactoring
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
23. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 2323
OO Design ConceptsOO Design Concepts
•• Design classesDesign classes
–– Entity classesEntity classes
–– Boundary classesBoundary classes
–– Controller classesController classes
•• InheritanceInheritance——all responsibilities of aall responsibilities of a
superclasssuperclass is immediately inherited by allis immediately inherited by all
subclassessubclasses
•• MessagesMessages——stimulate some behavior to occurstimulate some behavior to occur
in the receiving objectin the receiving object
•• PolymorphismPolymorphism——a characteristic that greatlya characteristic that greatly
reduces the effort required to extend thereduces the effort required to extend the
designdesign
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
24. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 2424
A wellA well--formed design classformed design class
•• Complete and sufficientComplete and sufficient
–– Encapsulation of attributes and methods thatEncapsulation of attributes and methods that
are reasonably expectedare reasonably expected
•• PrimitivenessPrimitiveness
–– Methods associated with a design class shouldMethods associated with a design class should
be focused on accomplishing one service forbe focused on accomplishing one service for
the classthe class
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
25. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 2525
•• High cohesionHigh cohesion
A small, focused set of responsibilities And noA small, focused set of responsibilities And no
other method to accomplish the same serviceother method to accomplish the same service
singlesingle--mindedly applies attributes andmindedly applies attributes and
methods to implement those responsibilitiesmethods to implement those responsibilities
••Low couplingLow coupling
Collaboration is necessary, but should be keptCollaboration is necessary, but should be kept
to an acceptableto an acceptable minimum.Methodsminimum.Methods only sendonly send
messages to neighboring classesmessages to neighboring classes
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
26. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 2626
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
CRCmodels
collaborat ion diagrams
use-cases - t ext
use-case diagrams
act ivit y diagrams
swim lane diagrams
collaborat ion diagrams dat a f low diagrams
cont rol-f low diagrams
processing narrat ives
dat a f low diagrams
cont rol-f low diagrams
processing narrat ives
st at e diagrams
sequence diagrams
st at e diagrams
sequence diagrams
design class realizat ions
subsyst ems
collaborat ion diagrams
design class realizat ions
subsyst ems
collaborat ion diagrams
ref inement s t o:
deployment diagrams
class diagrams
analysis packages
CRC models
collaborat ion diagrams
component diagrams
design classes
act ivit y diagrams
sequence diagrams
ref inement s t o:
component diagrams
design classes
act ivit y diagrams
sequence diagrams
design class realizat ions
subsyst ems
collaborat ion diagrams
component diagrams
design classes
act ivit y diagrams
sequence diagrams
analysis model
design model
Requirement s:
const raint s
int eroperabilit y
t arget s and
conf igurat ion
t echnical int erf ace
design
Navigat ion design
GUI design
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
27. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 2727
Design Model ElementsDesign Model Elements
•• Data elementsData elements
•• Architectural elementsArchitectural elements (floor plan of a house)(floor plan of a house)
•• Interface elementsInterface elements (detailed drawing for doors, windows,(detailed drawing for doors, windows,
external utilities)external utilities)
•• Component elementsComponent elements (detailed drawing of each room,(detailed drawing of each room,
wiring, place of switcheswiring, place of switches……))
•• Deployment elementsDeployment elements
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
28. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 2828
Design Model ElementsDesign Model Elements
•• Data elementsData elements
–– Data model at component levelData model at component level ----> data structures> data structures
–– Data model at architecture levelData model at architecture level ----> database architecture> database architecture
•• Architectural elementsArchitectural elements (floor plan of a house)(floor plan of a house)
–– Application domainApplication domain
–– Analysis classes, their relationships, collaborations and behaviAnalysis classes, their relationships, collaborations and behaviors areors are
transformed into design realizationstransformed into design realizations
–– Patterns and stylesPatterns and styles
•• Interface elementsInterface elements (detailed drawing for doors, windows, external utilities)(detailed drawing for doors, windows, external utilities)
–– the user interface (UI)the user interface (UI)
–– external interfaces to other systems, devices, networks or otheexternal interfaces to other systems, devices, networks or otherr
producers or consumers of informationproducers or consumers of information
–– internal interfaces between various design componentsinternal interfaces between various design components..
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
29. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 2929
•• Component elementsComponent elements (detailed drawing of(detailed drawing of
each room, wiring, place of switcheseach room, wiring, place of switches……))
–– Internal details of each software componentInternal details of each software component
•• Data structures,Data structures,
•• algorithmic details,algorithmic details,
•• interface to access component operation (behavior)interface to access component operation (behavior)
•• Deployment elementsDeployment elements
–– How software functionality and subsystems will beHow software functionality and subsystems will be
allocated within the physical computingallocated within the physical computing
environmentenvironment
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
30. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 3030
Interface ElementsInterface Elements
Cont rolPanel
LCDdisplay
LEDindicat ors
keyPadCharact erist ics
speaker
wirelessInt erf ace
readKeySt roke()
decodeKey ()
displaySt at us()
light LEDs()
sendCont rolMsg()
Figure 9 .6 UML int erface represent at ion for Cont rolPa ne l
KeyPad
readKeyst roke()
decodeKey()
< < int erface> >
WirelessPDA
KeyPad
MobilePhone
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
32. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 3232
Deployment ElementsDeployment Elements
Figure 9 .8 UML deploym ent diagram for SafeHom e
Personal comput er
Security
homeManagement
Surveillance
communication
Cont rol Panel CPI server
Security homeownerAccess
externalAccess
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net
33. 2/5/20092/5/2009 s.sreenivasa Raos.sreenivasa Rao 3333
Design PatternsDesign Patterns
•• The best designers in any field have an uncanny ability to seeThe best designers in any field have an uncanny ability to see
patterns that characterize a problem and corresponding patternspatterns that characterize a problem and corresponding patterns
that can be combined to create a solutionthat can be combined to create 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 designign
forces.forces.
–– Design forcesDesign forces describe nondescribe non--functional requirements (e.g., ease offunctional requirements (e.g., ease of
maintainability, portability) associated the software for whichmaintainability, portability) associated the software for which thethe
pattern is to be applied.pattern is to be applied.
•• TheThe pattern characteristicspattern characteristics (classes, responsibilities, and(classes, responsibilities, and
collaborations) indicate the attributes of the design that may bcollaborations) indicate the attributes of the design that may bee
adjusted to enable the pattern to accommodate a variety ofadjusted to enable the pattern to accommodate a variety of
problems.problems.
www.jntuworld.com
www.jntuworld.com
www.jwjobs.net