13 Jun 2016

UML - Unified Modeling Language

UML has two types of diagrams - 

  1. Structure diagrams - defines the static structures of the design - Class diagram 
  2. Behavior diagrams - defines the activities of the design - Sequence diagram, activity diagram, use case diagram.

1. UML Class diagram structures - A structure diagram

Conceptual model - Helps to understand the entities and the interaction between them.

You must know the following structures before you claim that you know UML class diagrams!!!


  1. UML building blocks
  2. Rules to connect the building blocks
  3. Common mechanism of UML

+ - Public access specified in class diagram.
# - Protected access specified in class diagram.
- - Private access specified in class diagram.

In class diagram the abstract class is defined by writing the class name in italic.

Implementing an Interface is called as Realization in UML class diagram. i.e Car realizes a Vehicle behavior. 


Default value to an attribute in a class


Represent Static method or attribute in a class


      To represent static method or attribute in a class diagram underline the specific method or attribute in the class diagram.





References:



2. UML Sequence diagram structures - a kind of Interaction Diagram

Message can be of two types

  • Synchronous - Represented by solid arrow mark 

  • Asynchronous - Represented by stick arrow head









References:

http://www.ibm.com/developerworks/rational/library/3101.html

3 Jun 2016

Composition vs Aggregation in Association.

Association is a term used to define two related classes in Object oriented Environment.

Aggregation and Composition defines how the two classes are related.

Aggregation - Aggregation says that two classes are related but each individual class has its own existence. For Example : School and Student, these two classes are interrelated, School has Students and Student belongs to a School. But if the School is closed that does not implies that a Student does not exist. The Student can join other School.

Aggregation is mentioned as a hollow diamond ending arrow in UML - class diagram.

Composition - Composition defines a "Has a" relationship between two classes. Common example of composition is Human and Human heart. If Human dies then the heart will die certainly.

Composition is mentioned as a filled diamond ending arrow in UML - class diagram.



Note: In the above diagrams the diamond should be towards Contained class. i.e Car as engine so the diamond should be close to Car.