Class Diagrams

Class DiagramsUML
1.0x

Class Diagrams

Created 3 years ago

Duration 0:08:16
lesson view count 736
Select the file type you wish to download
Slide Content
  1. Class Diagrams

    Slide 1 - Class Diagrams

    • Emerson Murphy-Hill
    • Creative Commons Attribution 4.0 License.
    • Material Produced by NCSU Software Engineering Faculty.
  2. Class Diagram

    Slide 2 - Class Diagram

  3. Class

    Slide 3 - Class

    • A class encapsulates state (attribute) and behavior (operations).
    • Each attribute has a type.
    • Each operation has a signature.
    • The class name is the only mandatory information.
    • name
    • attributes
    • operations
  4. Attributes

    Slide 4 - Attributes

    • visibility name: type multiplicity = default {property string}
    • - isPrepaid: boolean [1] = false {readOnly}
    • Only name is required in official UML diagrams
    • For exams: visibility, name, and type
    • attributes
  5. Operations

    Slide 5 - Operations

    • visibility name (parameter list) : return_type {property_string}
    • Parameter list: direction name: type = default value
    • + dispatch(): void
    • + billForMonth(amount:int): void
    • operations
  6. Association

    Slide 6 - Association

    • has-a
    • Indicated by a solid arrow line from the source class to the target class
    • Can be bi-directional represented by lines without arrow heads
    • Don’t usually put the association down as an attribute in the class
  7. Multiplicity

    Slide 7 - Multiplicity

  8. Aggregation vs. Composition Part-Whole hierarchy

    Slide 8 - Aggregation vs. Composition Part-Whole hierarchy

    • Aggregation: stronger association (unidirectional)
    • Ex. A department contains a set of employees
    • Ex. A faculty contains a set of teachers
    • Parts (employees, teachers) of meaning outside of whole (department, faculty)
    • A white diamond at the end of the association next to the aggregate class
    • Composition: stronger aggregation (unidirectional)
    • Ex. Invoice– InvoiceLine
    • Parts (InvoiceLine) have no meaning outside of whole (Invoice)
    • A black diamond on the end of association next to the composite class
  9. Generalization

    Slide 9 - Generalization

    • Generalization relationships denote inheritance between classes.
    • Concrete parents
    • Abstract Classes
    • The children classes inherit the attributes and operations of the parent class.
    • is -a
    • is -a
    • Indicated by a hollow arrow
  10. Abstract Classes and Interfaces

    Slide 10 - Abstract Classes and Interfaces

    • Interface
    • Abstract Class
    • Abstract Method
    • Overriding
    • Dependency
    • (requires interface)
    • Implementation
    • (provides interface)