Your SlideShare is downloading. ×
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
11 Class Diagrams
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

11 Class Diagrams

2,279

Published on

Published in: Technology
1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total Views
2,279
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
117
Comments
1
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. TK2023 Object-Oriented Software Engineering CHAPTER 11 CLASS DIAGRAMS
  • 2. INTRODUCTION
    • UML provides class diagrams for illustrating classes, interfaces and their associations.
    • Class diagrams are used for static object modelling.
    • Note that class diagrams are also used for visualizing domain models.
    • The term design class diagram (DCD) will be used to refer to the class diagram used in the design perspective (as opposed to the conceptual perspective).
  • 3. Register ... endSale () enterItem (...) makePayment (...) Sale time isComplete : Boolean / total makeLineItem (...) Register ... Sale time isComplete : Boolean / total Captures 1 1 1 Domain Model conceptual perspective Design Model DCD ; design perspective currentSale
  • 4. ATTRIBUTES
    • Attributes of a class can be shown in the attribute text notation.
    • Use this notation for data type objects i.e. objects for which unique identity is not important.
    Person name : String dob : Date ...
  • 5.
    • Attributes of a class can also be shown in the association line notation.
    • Note the following style:
      • a navigability arrow pointing from the source to the target object
      • a multiplicity at the target end, but not the source end
      • a rolename only at the target end to show the attribute name
      • no association name
    Register ... ... Sale ... ... 1 currentSale
  • 6.
    • Visibility marks are used to indicate whether an attribute is public, private or protected.
      • If no visibility is given, attributes are usually assumed private.
    - owner 1 Car + year : int Person # name : String public attribute private attribute protected attribute
  • 7.
    • When using class diagrams to show domain models:
      • show association names
      • avoid navigation arrows
  • 8. OPERATIONS AND METHODS
    • Examples of operations:
    • An operation is assumed public if visibility is not indicated.
    Rectangle + setLength(int val) + getArea() : int
  • 9.
    • An operation is not a method. In UML, an operation is a declaration whereas a method is its implementation.
    • getter and setter operations are usually filtered out in class diagrams because they generate high noise-to-value ratio.
      • Example: getArea(), setLength(val)
  • 10. INHERITANCE
    • Inheritance relationships between a superclass and its subclasses can be expressed in a class diagram as shown below.
    Shape #colour : Colour ... Rectangle length : int height : int ... Circle radius : int ...
  • 11. DEPENDENCY RELATIONSHIP
    • A dependency relationship exists between a client element (of any kind, including classes, packages, use cases, etc) has knowledge of another supplier element and that a change in the supplier could affect the client.
  • 12.
    • Example: Suppose the class Workshop has the following operation
    • void addClient(Customer c, Vehicle v)
    Workshop ... Vehicle ... ... ... Customer ... ...
  • 13.
    • Note that the dependency relationship is a very general one.
      • For example, an inheritance relationship is actually a kind of dependency relationship.
    • Use the guideline below for DCDs:
        • Use the dependency line to show the following types of dependencies between objects:
          • global
          • parametric
          • local
  • 14. RELATIONSHIP BETWEEN INTERACTION AND CLASS DIAGRAMS
    • When interaction diagrams are drawn, a set of classes and their methods emerge from doing dynamic object modelling.
    • This means that definitions of class diagrams can be generated from interaction diagrams.
    • This suggests a linear ordering of drawing interaction diagrams before class diagrams.
    • In practice, these complementary dynamic and static views are drawn concurrently.

×