Professional Documents
Culture Documents
35 1
Note: there is so much more than below…
35 2
We want to:
Refine relationships, operations, and attributes
35 3
Class Design in Context
Architectural
Analysis
Subsystem Design
Use-Case
Analysis
Review the
Use-Case Design Design
Designer Design Reviewer
Class
Design
Analysis
MainWindow SubWindow
MainForm
Button DropDownList
35 6
Recall: Entity Classes (1 of 3)
Entity objects are often passive and persistent
May be distributed…
FatClass
- transientBookeeping
<< entity >> + getCommonlyUsedAtt1()
Analysis
FatClass + getCommonlyUsedAtt2() Design
- transientBookeeping + getRarelyUsedAtt3()
+ commonlyUsedAtt1 + getRarelyUsedAtt4()
+ commonlyUsedAtt2
+ rarelyUsedAtt3
+ rarelyUsedAtt4 1 1
FatClassDataHelper FatClassLazyDataHelper
+ commonlyUsedAtt1 + rarelyUsedAtt3
+ commonlyUsedAtt2 + rarelyUsedAtt4
35 8
Entity Classes
From a data standpoint, will consider the FatClass to be a proxy in front
of the two real persistent data classes.
35 12
Important Note.
Persistent classes may come from entity classes.
May also be needed to handle some non-functional
requirements…
Examples:
Persistent objects needed to maintain information relevant to process
control, or
Persistent objects needed to maintain state information between
transactions.
35 13
A Closer look at Classes
35 14
Class Operations
Purpose
Map responsibilities (analysis) (from use cases or
user stories) to operations (design) that
implement them
Things to consider regarding class operations:
Operation name, signature, and description
Operation visibility
Operation scope
Class operation vs. instance operation
Operations: define at most primitive level to
promote reusability and maintainability.
35 15
Class Operations: Name and Describe
35 17
Discovering Additional Classes and Relationships
ClassA Class2
op1(var1:Class2): Class3
• Parameters and return types may lead to discovery
of other classes.
• Operation parameters and return classes denote
a relationship between these classes and the
parameter class and/or the return class.
Class3
support signature
Class Visibility – How Noted?
The following symbols are used to specify export control for
attributes and operations:
+ Public access
# Protected access
- Private access
In Java we also have package visibility.
Class
- privateAttribute
# protectedAttribute
+publicOp()
# protectedOp()
- privateOp()
35 19
Class Operation and Attribute Scope.
Determines number of instances of attribute or
operation
Instance scope: one instance for each class instance (object)
(instance variables…)
Class scope: one instance for all class instances (objects)
Static variables in Java. Don’t need instantiations…
Class scope: underline attribute/operation name
Generally, we have instance scope; but can have class scope
for may other practical reasons: counters, global data
(cough) etc.
Class scoped operations can only access class-scoped
attributes. (in Java, class scope static)
Class
- classifierScopeAttribute
- instanceScopeAttribute
classifierScopeOperation()
35 20
instanceScopeOperation()
Example: Scope
<<entity>>
Student
- name
- address
- studentID
- nextAvailID : int
• Each Student instance has it’s own unique student-ID, name, address,
whereas, there is only one nextAvailID for all Student instances.
<<entity>> +alternateCourses
Student. 1
(from University Artifacts) +primaryCourses
+ getTuition() : double 0..2 0..4
+ addSchedule(theSchedule : Schedule)
+ getSchedule(forSemester : Semester) : Schedule <<entity>>
+ deleteSchedule(forSemester : Semester) CourseOffering
+ hasPrerequisites(forCourseOffering : CourseOffering) : boolean (from University Artifacts)
# passed(theCourseOffering : CourseOffering) : boolean
<<class>> + getNextAvailID() : int Note: the <<class>> operations.
+ getStudentID() : int Note: + classes (invoked by clients);
+ getName() : string
+ getAddress() : string # only invoked by defining class/subclasses,
35 (usually correspond to reflexive operations
22
on interaction diagrams; (more )
Review: Package Element Visibility
PackageA Only public classes
can be referenced
outside of the owning
Class A1 package
Class A2
A Can specify visibility for
Class A3 package elements
(i.e., classes….) in
same way as class
attributes / operations
PackageB (can protect classes)
B Shows how other
packages can access
+Class B1
the elements owned by
-Class B2
Class has Public visibility the package.
35 25
Define Dependency
What Is a Dependency?
26
Dependency - more
A dependency relationship denotes a semantic
relationship between model elements, where a change in
the supplier may cause a change in the client.
Semantics focuses on the relation between signifiers,
such as words, phrases, signs, symbols, ….
Need to
Determine what causes the supplier to be visible to the client
35
Client Supplier
35 27
Dependencies vs. Associations*
Associations are structural relationships
i.e., numbers of one type related to another; parts, lifetimes, ….
Aggregates (has_a) generalization (is_a), …
Association
1 Client
Supplier1 0..1
buyer
broker
ClassB
35 31
Parameter Visibility Dependency
The ClassB instance is passed to the
ClassA instance – hence a dependency.
ClassA
35 32
Global Visibility Dependency
The ClassUtility instance is visible
because it is global. Clear dependency.
op1() uses something in a ClassUtility
object.
ClassA
op1 ()
ClassUtility
utilityOp ()
35 33
Field Visibility Association
The ClassB instance is visible. There is an
‘association.’
Not temporary; Every instance of ClassA has an
object of ClassB
ClassA
ClassB
utilityOp ()
35 34
Example:Define Dependencies (before looking for dependecies)
(VOPC Register for Courses Use Case)
Up to here, most relationships have been <<Interface>>
associations and aggregations. (Analysis)( ICourseCatalogSystem
(from External System Interfaces)
Now, will see how some of these are refined
into dependencies. (design) + getCourseOfferings(forSemester : Semester) : CourseOfferingList
1
Much was done during analysis! courseCatalog
0..*
<<entity>>
<<control>>
Schedule
RegistrationController
(from University Artifacts)
(from Registration)
currentSchedule - semester
The dependency + // submit schedule()
0..1 0..1+ submit()
shown (next slide) + // save schedule() + // save()
+ // create schedule with offerings()
was previously + // getCourseOfferings(forSemester) : CourseOfferingList
# any conflicts?()
+ // create with offerings()
defined in the Define 0..1 0..*
0..* 0..*
Ops section to support alternateCourses primaryCourses
the Schedule operation registrant 1
0..2 0..4
signatures. 0..1
<<entity>>
<<entity>> CourseOffering
Student (from University Artifacts)
(from University Artifacts) - number : String = "100"
- name - startTime : Time
All associations - address - endTime : Time
- StudentID : int
/aggregations - days : Enum
Parameter visibility