Post

UML Diagrams

Overview

What are UML diagrams

  • Unified Modeling Language
  • It’s a rich language to model software solutions, application structures, system behavior and business processes.

Types of UML diagrams

  • alt-text
  • There are two main categories of UML Diagrams
    • Structural
      • Class diagram
      • Component diagram
      • Deployment diagram
      • Object diagram
      • Package diagram
      • Profile diagram
      • Composite structure diagram
    • Behaviorial
      • Use case diagram
      • Activity diagram
      • State machine diagram
      • Sequence diagram
      • Communication diagram
      • Interaction Overview diagram
      • Timing diagram

Good resources

Arrows, Symbols explained

Visibility / Access Modifers

  • something

Static

  • alt-text
  • Static attributes and methods are underlined
  • instance scope by default

Relationships

  • The arrows define relationships between the different components
  • Different types of Relationships

Dependency

  • alt-text
  • An object of one class might use an object of another class in the code of a method. If the object is not stored in any field, then this is modeled as a dependency relationship. For example, the Person class might have a hasRead method with a Book parameter that returns true if the person has read the book (perhaps by checking some database).

Inheritence

  • alt-text
  • Ex, the Tortoise, Otter and Slow Loris inherit the Animal class

Generalization

  • alt-text
  • A class extends another class. For example, the Book class might extend the Document class, which also might include the Email class. The Book and Email classes inherit the fields and methods of the Document class (possibly modifying the methods), but might add additional fields and methods.
  • Generally used for a base class or a subclass that extends a base class or abstract class

Realization

  • alt-text
  • A class implements an interface. For example, the Owner interface might specify methods for acquiring property and disposing of property. The Person and Corporation classes need to implement these methods, possibly in very different ways.
  • Generally used when a class implements an interface

Association

  • alt-text
  • simple
  • Ex. Otter eats sea urchin

One-way association

Aggregation

  • alt-text
  • Where there can be multiple of something
  • Where the part can exist without the whole
  • a tortoise can exists by itself or it could be in a creep, which is just a group of toroises
  • the child object can exist without the parent object
  • the diamond is at the end where it contains all the parts
    • ex. The creep contains the tortoises

Composition

  • alt-text
  • The child object cannot exists without the parent object
  • in the example the visitor center has a lobby, and also has a bathroom
  • if the visitor center was to be closed for construction so would the lobby and bathroom. So the lobby and bathroom cannot exist without the visitor center

Multiplicity

  • refers to the concept of denoting a number on a specific side in a uml relationship
  • alt-text
  • ex. there is 1.. to many bathrooms that can be at the visitor center
  • ex. but there is only 1 lobby

Diagrams

Structural Diagrams

Class diagram

  • alt-text
  • Class diagrams are the main building block of any object-oriented solution. It shows the classes in a system, attributes, and operations of each class and the relationship between each class.

Component diagram

Behavioral Diagrams

This post is licensed under CC BY 4.0 by the author.