UML: Class Diagrams Flashcards

1
Q

Class Diagrams:

Basic Description

A

Used to show the classes in a system and the associations/relations between the classes.

  • When developin models in the early stages of the SE process, classes may represent objects in the real world
  • Classes are represented with named boxes, including sections for Class Attributes and Operations
  • Relations are represented with lines drawn between two or more classes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Class Diagrams:

Classes

A

A class is represented by a box with three sections:

  • Class Name
  • Attributes
  • Operations/Methods

The Visibility of Attributes and Operations is indicated with a symbol just before the name:

  • Public (+)
  • Private (-)
  • Protected(#)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Class Diagrams:

Categories (3)

and Types of Relations (5)

A

Categories

  • Runtime Relation
  • Consistent Relations
  • Whole Part Relations

Types

  • Dependency ( Runtime)
  • Association (Consistent)
  • Composition (Whole Part)
  • Aggregation (Whole Part)
  • Generalization
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Class Diagrams:

Relations:

Associations

A

Represents a general association between two objects with an arrowed line

  • Objects on both sides can “find” each other
  • Relation is consistent in time
  • May also have an Association Class that is attached to or represents the association
    • In this case, a dotted line goes from the association line to the association class (in a T)
  • Multiplicity is marked at each end of the relation:
    • * - unbounded (1 or more)
    • Specific number or range
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Class Diagrams:

Relations:

Aggregation

A

Represents a “Whole Part” or “Has A” relationship between classes

Indicated with a diamond symbol attached to the “Owner” class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Class Diagrams:

Relations:

Generalization

A

Represents Inheritence/Subclasses

A white arrow points to the Parent Class, with the line branching out to each of the Child Classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Class Diagrams:

Relations:

Composition

A

A stronger form of aggregation.

Contained classes live exclusively within the lifecycle of their Owner/Container.

Represented by a black diamond attached to the Container class, with an arrow pointing to the contained class and an indication of multiplicity.

Usage example: UI components in a Window object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Class Diagrams:

Relations:

Aggregation vs Composition

A

Aggregation

Composition

“Parts” can be shared by several “wholes”

“Parts” are exclusive to one “whole”

“Parts” may live independently of a “whole”

Parts exist only as a part of the whole, are destroyed when the whole is destroyed

The Whole is not solely responsible for the part

The whole is solely responsible for the part

White diamond with arrow

White diamond, no arrow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Class Diagrams:

Relations:

Dependency

A

Indicates that one object affects the state of another

The most abstract type of relation.

  • Represented with a dotted line with open arrow
  • Relation line is labeled with some sort of action:
    • << action >>
    • Such as << creates >> or << modifies >>
How well did you know this?
1
Not at all
2
3
4
5
Perfectly