Static View of UML

Contents:

  •  Classes and object
  •  Inheritance
  •  Interface

Static view of UML

  • The static view is the foundation of UML. The elements of the static view of a model are the concepts that are meaningful in an application, including real-world concepts, abstract concepts, implementation concepts, computer concepts—all kinds of concepts found in systems.
  • The static view captures object structure. An object-oriented system unifies data structure and behavioral features into a single object structure.
  • The static view describes behavioral entities as discrete modeling elements, but it does not contain the details of their dynamic behavior. It treats them as things to be named, owned by classes, and invoked. Their dynamic execution is described by other views that describe the internal details of their dynamics.

CLASS Diagram

  • A class represents a discrete concept within the application being modeled—
    • a physical thing (such as an airplane),
    • a business thing (such as an order),
    • A logical thing (such as a broadcasting schedule),
    • an application thing (such as a cancel button),
    • a computer thing (such as a hash table),
    • or a behavioral thing (such as a task).
  • A class defines a set of objects that have state and behavior. State is described by attributes and associations
  • A class is a software module that represents and defines a set of similar objects, its instances. All the objects with the same properties and behavior are instances of one class.
    • An object is a chunk of structured data in a running software system. It can represent anything with which you can associate properties and behavior. Properties characterize the object, describing its current state. Behavior is the way an object acts and reacts, possibly changing its state.
  • Notation: notation for a class is a rectangle with compartments for the name of the class, attributes,
    and operations,

Example:   Class UML Diagram

class

Class Example:

–Car

  • Properies: plateNumber, ownerName, engineNo, color, totalDistance, brand, model
  • Operations: start(), changeColor(), changeOwner(), stop()

–Account

  • Properties: accountNo, ownerName, dateCreated, branch, signature, balance
  • Operations: withDraw(), deposit(), changeSignature()

–Course

  • Property: courseTitle, courseCode, department, ects
  • Operation: addCourse(), deleteCourse(), updateCourse()

Object Examples:

–Object Car

  • plate Number 2-A0250,
  • Owner name: Abebe Asirat
  • Color: Blue-Black
  • Model: A 400
  • Brand: Abay
  • currentTotal distance: 1370 KM
  • The operation changeColor() may result in changing the current state of the Car (w/c is blue –black color) to White
  • The operation start() may change the current total distance the car traveled to some other values

– Object Account

  • account No: 10005682321
  • owenr(s) Name: Eyuel Ketema
  • currentBalance: 5850 birr
  • dateCreate: 10/04/2015
  • Operation withDraw() with some amount deducts the current balance to some other value
  • Operation deposit() increments the current value of the account to some other value

Generalization, Specialization and Inheritance

A set of classes may use the generalization relationship and the inheritance mechanism built on it to share common pieces of state and behavior description.

Inheritance: Each kind of generalizable element has a set of inheritable properties.

Generalization relates more specific classes (subclasses) to more general classes (superclasses) that contain properties common to several subclasses.

A class may have zero or more parents (superclasses) and zero or more children (subclasses).
A class inherits state and behavior descriptions from its parents and other ancestors,and it defines state and behavior descriptions that its children and other descendants inherit.

  • the subclass may implement the operation in a different way. this is called method Overriding.

. Notation: a   generalization is drawn as an arrow from the child to the parent, with a large hollow triangle on the end connected to the parent

E.g. of Inheritance

inheritance

 

 INTERFACE

  • Interface. An interface is the description of behavior of objects without giving their implementation or state; an interface contains operations but not attributes, and it does not have outgoing associations that are visible to it. One or more classes or components may realize an interface, and each class implements the operations found in the interface.
  • it lacks instance variables and implemented methods
  • is a describes a portion of the visible behavior of a set of objects. The realization relationship relates a specification to an implementation. An interface is a specification of behavior without implementation; a class includes implementation structure. One or more classes may realize an interface, and each class implements the operations found in the interface.

 

Association

  • The association relationship describes semantic connections among individual objects of given classes. Associations provide the connections with which objects of different classes can interact.
  • An association describes discrete connections among objects or other instances in a system.
  • An aggregation is an association that represents a part-whole relationship.
  • composition is a strong kind of aggregation in which if the aggregate is destroyed, then the parts are destroyed as well.

 

  • An association can also have attributes of its own, in which case it is both an association and a class—an association class.
  •  a circumstances, an attribute that concerns two associated classes cannot be placed in either of the classes
  • Any time you see a many-to-many association, you should consider whether an association class is needed.

E.g for Association Class

asscls

 

Reference:

  • The Unified Modeling Language Reference Manual, James Rumbaugh Ivar Jacobson Grady Booch, ADDISON-WESLEY 1999.
  • Object-Oriented Software Engineering Practical software development using UML and Java Second edition, Timothy C. Lethbridge Robert Laganière, 2006