Unformatted text preview: s of communicating classes and objects that are customized to solve a general design problem in a particular context. 7 OMT notation OMT notation Class diagrams: Class deGinitions A Class is a rectangle (cont d) Class name italicized in case of abstract classes Three sections: Class name, operations, and variables Separate sections by horizontal lines Type identiGiers are optional Class_name
Operation1() type Operation2() variable1 type variable2
9 Class relationships: Inheritance Inheritance relationship is represented as an arc with a triangle directed from the subclass(es) to the superclass Person
get_name() change_name() String name long SSN Student
get_GPA() ... course_list ... 10 OMT notation OMT notation Class containment (aggregation) Directed arc with diamond at tail Full circle means many Label is optional Class reference (acquaintance) Again, label is optional Directed arc from class deGining reference to referenced class Car Container ... Course ...
attendees owner Person ... Element ... Student ...
11 ... 12 OMT notation OMT notation OMT Extensions by Go4 Object creation: a dashed arc Creator
... owner OMT: Object Diagrams Show composition of objects at run time Created
... An object is a box with rounded corners or an oval Example aDspObj
Obj Obj ... Code annotations !
Get_area() double width double height return width*height;
13 aCircle aSquare ...
14 ... OMT notation Pattern OMT: Interaction Diagrams The Proxy pattern Show interactions among objects at run time time Context: Situations in which access to an object should be deferred Examples: In graphical application, protect objects whose display is expensive or slow (e.g., picture) In network application, facilitate access to distributed objects (e.g., make it easy for client to Gind server) In OS application, protect objects from unauthorized access 15 16 Pattern Pattern
draw() getExtent() load() The Proxy pattern (cont d) Problem: Prevent an object from being accessed directly by its clients Example of a graphical proxy ... Solution: Use an add...
View Full Document
- Spring '12
- Object-Oriented Programming, Design pattern, Subroutine