Presentation is loading. Please wait.

Presentation is loading. Please wait.

Class Diagram Notation Lecture Oo12 Classes Packages.

Similar presentations


Presentation on theme: "Class Diagram Notation Lecture Oo12 Classes Packages."— Presentation transcript:

1 Class Diagram Notation Lecture Oo12 Classes Packages

2 References n Ambler, S., The Object Primer, Cambridge Univ. Press, 2001, Section 6.3, 6.9, 7.1, 7.2,

3 Teaching Points n Class Characteristics n Packages n Package Diagrams

4 Review n What are the different visibility types? n Describe each type n When does a visibility type make sense to use?

5 Access Control n also known as visibility in UML (encapsulation visibility vs. object visibility) n Three kinds of encapsulation visibility –Private –Protected –Public

6 Encapsulation Visibility Markings n - (or a pad lock) = Private n # (or a key) = Protected n + (or no marking) = Public

7 Example (Attribute/Operation Markings)

8 Example (Relationship Markings)

9 Static Class Members n Static attributes (data members) are held in the program static data space n There is only one copy of such data for the class (i.e. one for all object instances of that class) n These can be thought of as “Class data” n Can be used to reduce global data

10 Example (Static Attributes)

11 Class Specifications n Diagrams by themselves do not provide enough detail to fully understand the problem/solution n Specifications provide a detailed understanding of the class and its semantics n Diagrams really must be accompanied by some specification

12 Class name: Heater Category:Logical View Documentation: This is an abstract class that provides a common interface to heaters in the system. A client object can provide a required temperature to a heater. The heaters have a temperature sensor built in and feedback from this sensor is used to contol the temperature. External Documents: Export Control:Public Cardinality:n Hierarchy: Superclasses:none Associations: : TempController in association Public Interface: Operations: setTemp Private Interface: Attributes: desiredTemp : Temperature The currently required temperature for the object to be heated. Implementation: Attributes: desiredTemp : Temperature The currently required temperature for the object to be heated. State machine:No Concurrency:Sequential Persistence:Transient

13 Operation Specification Operation name: getTemp Public member of:TempRamp Return Class:Temperature Arguments: TimecurrentTime Documentation: Given a normalized time this function returns the temperature computed from the ramp function. Concurrency:Sequential

14 Package Diagrams n Large flat (non-hierarchical) class diagrams are complex and hard to understand n It is hard to see structure n It is hard to find a class for maintenance or reuse

15 Package Diagrams n Solution: –apply abstraction, decomposition and hierarchy –group the classes together in higher level units

16 Packages n A grouping of mutually dependent classes n Apply rules of coupling and cohesion n Packages are elements of a class diagram (i.e. package diagrams are class diagrams)

17 Package Dependencies n The relationship between packages is the Dependency relationship n Classes in packages have visibility (access control) applied to them for information hiding purposes –only some of the classes are visible (public) to users of the package –some classes are private (implementation) to the package and can be changed without effecting users of the package

18 Example n Rose package diagram for Chemical Process Controller

19 Flat Model

20 Package Diagram (top level)

21 Controller Logic Package

22 Drivers Package

23 System Package

24 Teaching Points n Class Characteristics n Packages n Package Diagrams


Download ppt "Class Diagram Notation Lecture Oo12 Classes Packages."

Similar presentations


Ads by Google