Documente Academic
Documente Profesional
Documente Cultură
Object-Oriented Analysis
Object-Oriented Analysis
Definition
Analysis facilitates the difficult transition between problem domain and solution domain, i.e., between the world and the machine
Object-Oriented Analysis
USDP Context
Elaboration Inception Construction Transition
Requirements
Analysis
Design
Implementation Test
Preliminary iterations iteration iteration iteration iteration iteration iteration #1 #2 #n #n + 1 #n + 2 #m iteration #m + 1
Analysis Classes
An analysis class abstracts one or more classes and/or
subsystems in the systems design
the class)
Focuses on handling functional requirements Defines responsibilities (cohesive subsets of behaviour defined by Defines attributes Expresses relationships the class is involved in
Identifying Classes
Identify all the data in the system Divide into classes before considering responsibilities Common approach: noun identification
Identify candidate classes by selecting all the nouns and noun
Redundant or omnipotent entities Vague entities Events or operations Meta-language Entities outside system scope Attributes Verbs and verb phrases highlight candidate operations!
Software Engineering (GC22) 2007 David S. Rosenblum
Exercise
Go back to your requirements document and set of use
cases for the library system
And anything else you might have gathered or created by now
Underline all the nouns and noun phrases Create a list of candidate classes
In examining the discard criteria, you may also identify some
candidate attributes
Underline all the verbs and verb phrases Create a list of candidate operations and assign them to
the classes
Identifying Classes
Identify all the responsibilities in the system Divide into classes before considering the classes data Common approach: CRC cards
Class, Responsibilities, Collaborations
Collaborators Copy
Collaborators Book
Collaborators
Exercise
Go back to your requirements document and set of use
cases for the library system
And anything else you might have gathered or created by now
Create a set of CRC cards using post-it notes Information gathering: Use this material as a prompt, but
then brainstorm the things operating in the library system domain
Accept all ideas at this point and write each as a candidate class
on a separate card
Information analysis
Stick all cards on a wall and, as a group, try to determine
Class name
(in italics if abstract)
} } }
Book #title : String #available : Boolean = true <<constructor>> +create() +copiesOnShelf() : Int +borrow(c:Copy)
Software Engineering (GC22)
Attribute name Attribute type Initial value Operation with class scope and <<stereotype>> Operation signatures
2007 David S. Rosenblum
className
Software Engineering (GC22)
Polygon
2007 David S. Rosenblum
scope
Class scope
Attributes with class scope have a single shared value for every
It has a small but defined set of responsibilities It has high cohesion It has low coupling with other classes
} }
Attribute name Attribute value Operations and attribute types are not shown on object diagrams!
Software Engineering (GC22) 2007 David S. Rosenblum
objectName: className
attribute name: type = value
triangle1: Polygon
centre = (0,0) vertices = (0,0), (4,0), (4,3) borderColour = black fillColour = white
display (on: Surface) rotate (angle: Integer) erase () destroy () select (p: point): Boolean
objectName: className
Software Engineering (GC22)
triangle1: Polygon
2007 David S. Rosenblum
Exercise
Compare the results of using noun identification and CRC
cards for identifying candidate classes in the library system
Relationships
Relationships are connections between modelling
elements
Improve understanding of the domain, describing how objects
work together
of of of of
A A A A
sends a message to object of class B creates an object of class B has attribute whose values are objects of class B receives a message with argument of class B
association name
[+ single directional arrow]
supplementary characteristics
LibraryPatron
borrows
Book
DSR:LibraryPatron
usingUML: Book
Multiplicity of an Association
Indicates the number of objects
that can participate in a relationship at any point in time borrows/returns
0..1 0..*
Book is copy of
1 1..*
LibraryPatron
Copy
0..*
0..1
borrows/returns borrows/returns
0..1
Software Engineering (GC22)
MemberOfStaff
0..*
Journal
2007 David S. Rosenblum
Exercise
Using your initial analysis class diagram for the library
Consider the interactions in your earlier use cases Consider the CRC cards you produced and the listed collaborators
LibraryPatron
Superclass
borrows/returns
0..1 0..*
Subclass
0..1
borrows/returns borrows/returns
0..1
Software Engineering (GC22)
Researcher
0..*
Journal
2007 David S. Rosenblum
Librarian assignSubject(String)
Tutor assignCourse(String)
Researcher beginProject(String)
Part/Whole Associations
Aggregation: Weak Ownership
The part objects can feature simultaneously in any number of
Course
1..*
5..*
Module
elsewhere
CheckerBoard
64
Square
Derived Associations
Is it necessary to show all associations?
Sometimes associations that are not explicit can be deduced from
the diagram
Student
Module
/teaches
Association Classes
Used to attach attributes to an association itself rather
than the classes it associates
Module
Association class
10
Exercise
Examine your updated analysis model (i.e., the one that
shows classes, attributes, operations, named associations, multiplicity and navigability)
Architectural Analysis
Architectural analysis involves organising analysis classes
into packages
Analysis classes Use case realisations
NOTE: This is a rather inadequate big picture notion of architecture that weakly accounts for system structure
Software Engineering (GC22) 2007 David S. Rosenblum
Package Diagrams
Description
Package name::package element Example (class attribute): Travel Agency::Agent::customerArray Example (operation): Library::BookBorrower::borrow(Copy)
11
Package Diagrams
Example
Library
Book Personnel Librarian
BookBorrower
use case
Interaction diagrams
Example collaborations between objects realising the use case at
moments in time
Special requirements
Realisation process helps uncover new requirements
12
Interaction Diagrams
Description
Mainly used to show how a system realises a use case (or a Two types
particular scenario in a use case)
Collaboration Diagrams
More prominent in UML 1.4 Called Communication Diagrams in UML 2.0 Sequence Diagrams UML 2.0 also introduces Interaction Overview diagrams to show flow relationships between individual interaction diagrams
Interaction Diagrams
Modelling Elements
Collaboration Diagrams
Objects: Computer entities participating in an interaction Actors: Users participating in an interaction Links: Communication paths between objects and actors Messages: Interaction instances between pairs of objects/actors
Sequence Diagrams
Objects: Computer entities participating in an interaction Actors: Users participating in an interaction Lifelines: Time-oriented representation of object/actor behaviour Focus of Control: Portion of lifeline having active computation Messages: Interaction instances between pairs of objects/actors
Collaboration Diagram
Example
theBook : Book
theLibraryMember : LibraryMember
theCopy : Copy
3 :borrow 2 :okToBorrow
Software Engineering (GC22) 2007 David S. Rosenblum
13
Collaboration Diagram
Example
Exercise
Create collaboration diagrams to illustrate how classes in
your analysis model for the library system support functionality specified in the use cases
Sequence Diagram
theLibraryMember : LibraryMember aMember : BookBorrower borrow(theCopy) okToBorrow borrow theCopy : Copy theBook : Book
Example
borrowed
14
Sequence Diagram
Example
Exercise
Take the collaboration diagram you have created for part
of your library system
either a collaboration diagram or sequence diagram that realises the use case Aim to practice both techniques evenly Update your analysis class diagram accordingly
Implementation view
Process view
Deployment view
2007 David S. Rosenblum
15