Copyright ©2004 Cezary Z Janikow 1 OOAD Overview n OO language – Necessary for OO systems? –...
-
Upload
willis-jenkins -
Category
Documents
-
view
213 -
download
1
Transcript of Copyright ©2004 Cezary Z Janikow 1 OOAD Overview n OO language – Necessary for OO systems? –...
Copyright ©2004 Cezary Z Janikow 1
OOAD Overview
OO language
– Necessary for OO systems?
– Sufficient for OO systems?
Owning a hummer doesn’t make you a home builder
OOAD is necessary in building QUAILITY OO systems
– Architectural cohesion
– Reusability
– Maintenance
Copyright ©2004 Cezary Z Janikow 2
OOAD Overview
Key importance– Assignment of Responsibilities
Performed during Design workflow
Responsibility-driven design
Follows GRASP principles
Successful designs become Patterns
Key elements and properties– Use Cases
Text description of vital transactions and scenarios
Not OO but usually used in OOAD
– Agile Process
Light, flexible, iterative form of the UP process
Iterative – performed in a number of successive builds
Copyright ©2004 Cezary Z Janikow 3
OOAD Overview
OOAD elements
Topics and Skills
UML notation
Requirements analysis
Principles and guidelines
Patterns
Iterative development with an agile Unified
Process
OOA/D
Copyright ©2004 Cezary Z Janikow 4
OOAD Overview
Analysis -> Design -> Implementation -> Deployment
– Analysis is investigation of the problem, requirements, constraints, technology
Emphasis on finding problem entities (conceptual classes), relationships, constraints
– Design is a conceptual solution, including architecture, algorithms, etc.
Emphasis on designing classes and objects with behavior to allow collaborations to solve particular requests while using patterns
– Implementation is expression of the design in code
Emphasis on utilizing the language of choice to implement design classes while exploring visibility, navigability, etc.
– Deployment is the actual installation in the host environment
Copyright ©2004 Cezary Z Janikow 5
OOAD Overview
Airplane example of object and class discovery
Plane
tailNumber
public class Plane{private String tailNumber;
public List getFlightHistory() {...}}
domain concept
visualization of domain concept
representation in an object-oriented programming language
Copyright ©2004 Cezary Z Janikow 6
OOAD Example
Rudimentary process
– UseCases -> DomainModel -> Interactions -> DesignModel
Dice game example
– 2 players rolling 2 dice
Use Case
– Verbal description of transactions or processes
– Player throws two dice. The result is observed. If the total is 7 the player wins otherwise he loses.
Copyright ©2004 Cezary Z Janikow 7
OOAD Example
Domain Model
– Static view of classes and relations
Player
name
DiceGame
Die
faceValue
Rolls
Plays
Includes
2
2
1
1
1
1
Copyright ©2004 Cezary Z Janikow 8
OOAD Example
Interactions
– Assignment of responsibilities among objects
– Sequence or Communication diagrams
:DiceGame
play()
die1 : Die
fv1 := getFaceValue()
die2 : Die
roll()
roll()
fv2 := getFaceValue()
Copyright ©2004 Cezary Z Janikow 9
OOAD Example
Design Diagrams
Software classes with methods according to responsibilities and attributes according to visibility
2
Die
faceValue : int
getFaceValue() : introll()
DiceGame
die1 : Diedie2 : Die
play()
1
Copyright ©2004 Cezary Z Janikow 10
UML UML
Visual Modeling Language
InterfaceX
AbstractClassX
...
«interface»InterfaceX
operation1()
ClassA ClassBAssociation-name role-1 role-2
1 1
zero ormore;"many"
one ormore
one toforty
exactlyfive
Class ClassClass Class* 1..*1..40 5
Whole
Part
1
*
AssociationClass
Composition
Multiplicity:
Associations:
ClassX
classAttribute+ publicAttribute- privateAttributeattributeWithVisibilityUnspecifiedattribute1 : typeburgers : List of VeggieBurgerattribute2 : type = initial valuefinalConstantAttribute : int = 5 { frozen }/derivedAttribute
classMethod()+ «constructor» ClassX(int)«signal» CaughtException1()methodWithVisibilityUnspecified()methodReturnsSomething() : FooabstractMethod()abstractMethod2() { abstract } // alternate+ publicMethod()- privateMethod()# protectedMethod()~ packageVisibleMethod()finalMethod() { leaf }methodWithoutSideEffects() { query }synchronizedMethod() { guarded }
exceptionsThrownException1
AlternateUMLForAbstractClass
{abstract}
...
ClassY
operation1()...
generalization interfaceimplementation
AlternateUMLForImplOfInterfaceX
operation1()
FinalClass{leaf}
...
Copyright ©2004 Cezary Z Janikow 11
UML Three perspectives (and class meanings in diagrams)
Conceptual – described the real world entities
Specification – describes design entities but not tied to specific implementations
Implementation – describes particular implementations of the specification elements
Conceptual Perspective(domain model)
Raw UML class diagram notation used to visualize real-world concepts.
Specification or Implementation
Perspective(design class diagram)
Raw UML class diagram notation used to visualize software elements.
2
Die
faceValue : int
getFaceValue() : introll()
DiceGame
die1 : Diedie2 : Die
play()
DiceGame Die
faceValue
Includes 21