UML&OOP

25 Oct 2023 . mmse .

Software modeling

  • A model is an abstraction describing a subset of a system
  • A view depicts selected aspects of a model
  • A notation is a set of graphical or textual rules for depicting views

Concepts and Phenomena

Phenomenon

– An object in the world of a domain as you perceive it

– Example: The lecture you are attending

Concept

– Describes the properties of phenomena that are common.

– Example: Lectures in software engineering course

Concept is a 3-tuple:

– Name (To distinguish it from other concepts)

– Purpose (Properties that determine if a phenomenon is a member of a concept)

– Members (The set of phenomena which are part of the concept)

Abstract Data Types and Classes

  • Abstract data type – Special type whose implementation is hidden from the rest of the system.
  • Class – An abstraction in the context of object-oriented languages
  • Like an abstract data type, a class encapsulates both state(variables) and behavior (methods)
  • Unlike abstract data types, classes can be defined in terms of other classes using inheritance
  • Unlike of classes, abstract data types may have axioms/constraints on the values of their members
  • Abstract data type is rather mathematical notion while class is a programming notion

UML

  • Use case Diagrams – Describe the functional behavior of the system as seen by the user.
  • Organizational diagrams – Packaging and components
  • Class diagrams – Describe the static structure of the system: Objects, Attributes, Associations
  • Sequence diagrams

    – Describe the dynamic behavior between actors and the system and between objects of the system

  • Communication diagrams – Alternative presentation of sequence diagrams
  • State diagrams

    – Describe the dynamic behavior of an individual object (essentially a finite state automaton)

  • Activity Diagrams

    – Model the dynamic behavior of a system, in particular the workflow (essentially a flowchart)

  • Component diagrams – Show structure of components
  • Deployment diagrams – Used to model the hardware that will be used to implement the system

Activity Diagrams

  • An activity diagram is a special case of a state chart diagram in which states are activities (“functions”)
  • Two types of states:

    – Action state:

    • Cannot be decomposed any further
    • Happens “instantaneously” with respect to the level of abstraction used in the model

    – Activity state:

    • Can be decomposed further
    • The activity is modeled by another activity diagram

State chart Diagram vs. Activity Diagram

  • State chart Diagram for Incident - (State: Attribute or Collection of Attributes of object of type Incident)

  • Activity Diagram for Incident - (State: Operation or Collection of Operations)