7 Patterns-442-12-by6

7 Patterns-442-12-by6

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

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[0] Obj[1] ... Code annotations ! Rectangle 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 Graphic 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

This note was uploaded on 02/23/2012 for the course COMP 553 taught by Professor Ajay during the Spring '12 term at Ill. Chicago.

Ask a homework question - tutors are online