Your SlideShare is downloading. ×
#OOP_D_ITS - 8th - Class Diagram
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

#OOP_D_ITS - 8th - Class Diagram

974
views

Published on

Published in: Health & Medicine, Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
974
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
45
Comments
0
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. C++ OOP :: Class Diagram
    28/10/2009
    1
    Hadziq Fabroyir - Informatics ITS
  • 2. Class
    a description of a group of objects with similar properties, common behavior, and common semantics.
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    2
  • 3. Class
    a template for instantiation of objects
    Contains:an attribute (state) section and a method (behavior) section
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    3
  • 4. Attribute
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    4
    visibilityopt <<sterotype>>optname multiplicityopt : typeopt = initial-valueopt {property-string}opt
    Example:Tagged value e.g.Author = Kari
    E.g. <<unique>>
    - (private) only the class can see
    this attribute
    # (protected) only the class and
    all of its subclasses
    + (public) all classes that can see
    the class can also see
    the attribute
    Example: email[1..*] :String
    Indicating one or more email addresses.
    If no email is present you will still have a
    the empty string (””).If email[0..*] : String is specified, the email
    can be null.
  • 5. visibilityopt <<sterotype>>optname(parameter-list) multiplicityopt : return-typeopt {property-string}opt
    Method
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    5
    Examples:+ <<query>> getX() : double+ setX (newX : double)
  • 6. Class Stereotypes
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    6
  • 7. Robustness Diagram Rules
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    7
  • 8. The Three Most Important Relationships In Static Modeling
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    8
    Base
    sub
    Class2
    Class1
    Class2
    Class1
    Generalization
    Association
    Dependency
  • 9. Generalization
    Also called generalization/specialization.
    Example: birds are animals, were birds are the most specialized and animals the most general.
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    9
  • 10. Generalization used in class diagrams
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    10
    superclass
    Animal
    generalization arrow
    subclass
    subclass
    Bird
  • 11. Association
    A relationship that describes a set of links between classes of objects, indicating some sort of connection between objects of the involved classes.
    Example: student follows a course.
    you can distinguish between ordinary association, simple aggregation and composition(strong aggregation).
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    11
  • 12. Simple Aggregation & Ordinary Association
    It seems difficult to give a formal definition of the distinction between the two concepts.
    Ordinary association is used when both of the involved classes are equaly important.
    If there is a part-of relation between the involved classes, then aggregation may be adequate. The question of using association or simple aggregation is a conceptual one, it does not say anything about navigation direction and no connection between lifetime is made.
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    12
  • 13. Association used in Class Diagram
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    13
    aggregation:
    association:
    assembly class
    class 1
    class 2
    role-2
    role-1
    name direction
    association:
    name
    class 1
    class 2
    part class
    part class
  • 14. Example
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    14
    University
    Faculty
    Teacher
    Institute
    works for
  • 15. Composition
    Composition is a strong type of aggregation indicating that the part object only exist as a part of the assembly class. The part object of an aggregation will be deleted if the assembly object is deleted. An object may be part of only one composite at a time.
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    15
    Composition can be represented in to different ways:
    assembly class
    assembly class
    part class
    part class
  • 16. 28/10/2009
    Hadziq Fabroyir - Informatics ITS
    16
    Window
    1
    Client Area
    *
    *
    0..2
    ScrollBar
    0..1
    Keyboard
    Mouse
    Menu
    Example
    Component
    Input Device
  • 17. Navigability
    If you have a Quiz-object, the associated Question-objects can be directly reach from the Quiz-object. You will typically find a reference of each object inside the Quiz-object.
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    17
    Quiz
    Question
    Direction of navigation
    1..*
    *
    ordinary association
    classQuiz{
    // A list of questions
    Question [] questions;
    ....
    }
    class Question {
    // no reference to Quiz
    ....
    }
  • 18. Dependency
    A dependency relationship indicate that a change in one class may effect the dependent class, but not necessarily the reverse.
    You use dependency when you wants to indicate that one thing uses another.
    Often used to indicate that a method has object of a class as arguments.
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    18
  • 19. Example: Dependency
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    19
    ActionListener
    ActionEvent
    actionPerformed(ActionEvent e)
  • 20. Multiplicity
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    20
    1
    1..*
    A
    B
    A
    B
    An A is associatedwith exactly one B
    An A is associatedwith one or more B
    *
    0..1
    A
    B
    A
    B
    An A is associatedwith zero or more B
    An A is associatedwith zero or one B
    The multiplicity is describing the number of participants (classes) involved in an association. For instance an edge in a graph is connecting exactly two vertexes.
  • 21. 28/10/2009
    Hadziq Fabroyir - Informatics ITS
    21
    ?
    End of slide show
  • 22. For your practice …
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    22
  • 23. Ex: undirected graph
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    23
    1
    1
    *
    *
    2
    *
    Graph
    Vertex
    Edge
  • 24. Ex: information system for school
    28/10/2009
    Hadziq Fabroyir - Informatics ITS
    24
    0..1
    has
    Department
    School
    1
    1..*
    1..*
    1..*
    1..*
    member
    assignedTo
    0..1
    chairperson
    1..*
    1..*
    *
    teaches
    attends
    student
    Course
    Instructor
    1..*
    *
    *
    *
  • 25. ☺~ Next: <Template> ~☺
    [ 25 ]
    Hadziq Fabroyir - Informatics ITS
    28/10/2009