Download presentation
Presentation is loading. Please wait.
Published byClaribel Rogers Modified over 9 years ago
1
pick of the day 10-Jan-2003 Lecture 2 Crash course on OO Analysis Models
2
January 10 2003Lecture 22 Outline Previous Business Survey Results Constructor Challenge Results Reading Questions Crash course in OO modeling Continuing Mini-Example
3
January 10 2003Lecture 23 Survey Results Topics of interest Primary OOD Secondary UML, OOP, Design Patterns, Software Architecture Tertiary Security, Swing, Transactions, Quaternary Persistence, Domain Analysis
4
January 10 2003Lecture 24 Reading Questions What is the “inherent identity” that Lau considers objects to have? [p. 1] Book b = new Book (); Book b2 = b; Book b3 = new Book(); // identity checked by comparing object references b == b2 // true b2 == b3 // false
5
January 10 2003Lecture 25 Equality tangent What is difference between == and equals Book b = new Book (); Book b2 = new Book(); // only Book class knows the answer if (b.equals (b2)) { } equals equals must be reflexive, symmetric, transitive
6
January 10 2003Lecture 26 Reading Questions Object state is set by the object’s operations. Is this the only way to set an object’s state? No:1) constructor can set initial state 2) class attributes can be pre-set upon construction 3) Thread of computation within object can alter values
7
January 10 2003Lecture 27 Reading Questions What is the difference between uni- directional and bi-directional associations? CategoryBook 1* The underlying link between the objects is one-way for unidirectional associations but two-way for bi-directional associations Category Books:Book[*] Book
8
January 10 2003Lecture 28 Reading Questions What is the practical impact of maintaining a bidirectional association? 1) referential integrity 2) simultaneous creation AB AB A
9
January 10 2003Lecture 29 Binary Associations Familiar to C programmers Links are realizations of associations Unidirectional: object reference (pointer) Bi-direction: more than doubly-linked list What is access scope of object? What are core operations?
10
January 10 2003Lecture 210 Binary Association Alternatives Does Book know of its Category “parent”? Does Category maintain “ownership” over the aggregate set? Can a change to a Book impact/invalidate set? Who is responsible for add/remove? Does the relationship scale to 10,000 books? 10,000,000 books? CategoryBook 1*
11
January 10 2003Lecture 211 N-ary associations How common are they? a complex set of binary associations can be greatly simplified through an n-ary association Committee Year Person post 0..2 1..4 3..5 Committee Year Person Post * * * * * *
12
January 10 2003Lecture 212 Aggregation and Composition Normal Association Aggregation special binary association between aggregate (the set) and its elements “operations on whole are propagated to subparts” Composition stronger than aggregation, implies that a sub-part is integral part of greater whole “whole cannot exist without subpart” but “subpart can exist without whole” Differences are subtle and may be refined later.
13
January 10 2003Lecture 213 Aggregate Composition Quiz Category ––––Book Frame –––– Button Canvas –––– Font Course –––– Student Polygon–––– Point Student–––– Identifier
14
January 10 2003Lecture 214 Aggregation/Composition Summary CharacteristicNormal Association AggregationComposition UML OwnershipNoneWeakStrong MultiplicityAny One : Any TransitivityNoYes Propagation of properties UndefinedWhole to Part
15
January 10 2003Lecture 215 Servant Classes & Delegation To reduce complexity and increase cohesion create new class as servant to existing class servant object has only one “master” operations are delegated to servant object Lau claims this leads to higher abstraction and better reuse. Why?
16
January 10 2003Lecture 216 Inheritance vs. Servant Point real x, y Circle Circle uses (x,y) as center But this can’t be right! Point real x, y Circle Point center abstract reuse
17
January 10 2003Lecture 217 Monday Assignments Read: TAOO: Chapter 2.1 – 2.4 Modeling exercise try to model Person, Committee, Year as only binary relationships try to model Post as a separate class to manage Person/Committee/Year relationships Exercise 2-1, 2-2
18
January 10 2003Lecture 218 References none
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.