UML Introduction

Unified Modeling Language (UML) is introduced by Grady Booch, Ivar Jacobson and Jim Rumbaugh in late 1990’s. UML is not a development language. It is a designing language. We can use this only designing part of the program. This use for,
1.  Specifying
2.  Visualizing
3.  Constructing
4.  Documenting

  •      Uses of UML
  1.       Create a model of software to represent the customer using this language
  2.       Easy to increase quality in the software
  3.       Easy to convert any programming language
  4.       Easy to understand
  5.       Encourage the transformation of Object Oriented tool market
  6.       Tally with high level concept
  7.       Always help to develop qualitative software


  •   Relationships in UML
In UML, we can connect the things physically or logically using three kinds of relationships.

1.  Dependency

Dependency is the relationship that connects two things which one thing can change the entity of other thing. This relationship not the reverse. This relationship represent using dash arrow.

An announcement gives instructions to the listener.
These instructions can change the listener.
But the listener cannot change the announcement.

2. Generalization
Generalization is the relationship that connects parent class and child class. All the behaviors and states of the parent class come to the child class. We use arrow to represent this connection.


Department 1 is a part of Company.



Company can divide to two Departments.


3. Association
Association is the relationship that connects the objects of a system to each others. We can know these as several types.

i.                  Name
If we can use a name to describe this relationship, we call it as “name association”. In this relationship, we don’t use arrow.
“Work for “is the name and arrow mark is the name direction.


ii.                  Role
If we can use the roles which the things act in the relationship, we call it as “role association”. In this relationship, we cannot use arrow.
iii.                  Multiplicity

Multiplicity is known as “how many”. We can represent the amount of relationships using this “Multiplicity relationship”.

There are 1 or more relationships between persons and company. There is 1 or more persons work in a company.

      iv.                  Aggregation

This is a relationship between two classes. The big class knows as “whole” and the small one knows as “part”. This part depends on the whole but whole class can work without part class in this association.


                                                                                             
Department is the “part” and company is the “whole”.


      v.                        Composition

This is a relationship between two classes. The big class knows as "whole" and the small one knows as "part" alike Aggregation association. This part depends on the whole as well as the whole depends on the part. Whole class cannot work without part class in this association.


  •      Diagrams in UML


A diagram is a graphical representation of relationships and elements.
  1.      Class diagram
  2.      Object diagram
  3.      Use case diagram
  4.      Interaction diagram
  5.      State chart diagram
  6.      Activity diagram
  7.      Component diagram
  8.      Deployment diagram


1. Class Diagrams

Class is the most important unit in Object Oriented programming. A class can represent a description about the object in that class.
We can use this class diagrams to analyze and design a system and describe about the responsibility of that system.  

Terms and concepts of class diagrams
i.                  Name
Every class has a name to identify among other classes.
ii.               Attributes
An attribute is a property of the class. One class may have more than 1 property but sometimes there is nothing.
iii.            Operations
An operation is the thing that objects can do in a class.
One class may have more than 1 property but sometimes there is nothing.

Example

·      University

In a university there are different classrooms, offices and departments. A department has a name and it contains many offices. A person working at the university has a unique ID and can be a professor or an employee.
A professor can be a full, associate or assistant professor and he/she is enrolled in one department.
Offices and classrooms have a number ID, and a classroom has a number of seats.
Every employee works in an office.






2.     Object Diagrams

Object diagram is depending on class diagram. In object diagrams we should represent the objects
in the class diagram. There are same concepts in both of class and object diagrams.             
Object diagram shows us a snapshot of the system at a particular moment. Because of this we 
call this diagram as static diagram. We can understand object behavior and their  
relationship using this diagram.
In object diagram we should underline the name object and write the name behind the object with 
“: “mark.


3. Use Case Diagrams
This diagram represent dynamic view of the system which the running period of the system. We
cannot identify all the behaviors of the system using static view. So these kinds of diagram are 
very important in UML programming.

In Use Case diagram, first we draw a case area. We draw people who join in this system out of 
the 
case area border. We call them as actors. There are internal and external actors in this diagram. 
These internal actors mean people who can connect with the case behaviors directly and external 
actors mean people who cannot connect with behaviors directly.
We draw all the behaviors in the case area and mark relationship between behaviors and actors 
and among behaviors.

We use these diagrams to gather requirements of a system and show the interaction among the 
requirements and actors. And also we can see the outside view of the system.

There are two types of relationship in this diagram. The INCLUDE relationship and the 
EXTENDED relationship.
In include relationship; we can split large use case into several use cases.


In extended relationship, use cases can stand up without any support or relationship. They are
always meaningful.

4 .Interaction Diagram
This diagram describes all the interaction among the elements in the system. This is a diagram 
that represents the dynamic view of the system.
There are two types of interaction diagrams. They are Sequence and Collaboration diagrams.
The sequence diagram has four objects.

·         Customer
·         Order
·         Special order
·         Normal order

In this diagram we can see all the objects in the system.

Collaboration diagram is another interaction diagram. This only shows the objects that active in
the running system. In this diagram we can know the order of the running objects.









5. Activity Diagram
Activity diagram is also representing the dynamic view of the system. This diagram shows as a 
flow chart but it is not a flow chart.  This flow can be sequential, branched or concurrent.
In this diagram we use only active objects.


6. State chart Diagram
State case diagram shows the states of the objects in the system. These states can control the 
events of the system. This diagram presents the dynamic view of the system. Anyone can 
exit from the system without finishing the path.



7. Component Diagram
Component diagram shows the physical object s that is used in the system. So we can use this 
diagram to represent the organization and relationship among components in system.





8. Deployment Diagram
Deployment diagram shows the topology of the physical component of the system. This is a static
deployment view of a system.




Reference:
class diagrams - SoftEng
softeng.polito.it/tongji/SE/ex/ClassDiagramsSol.doc
N.p., 2016. Web. 4 Dec. 2016.


Comments

Popular posts from this blog

C# Analog Clock

Basic Prolog (List)

SOLID Principles