Wednesday 26 December 2012

4. UML


In this post, I am going to explain more about UML and its significants.

As we know most of the techies are don’t use UML much and they don’t know exact usability of the UML. Generally techies are straightaway start writing coding & they spend most of the time related in terms of technologies. So they don’t know where the UML is fit for them until they use to realize.

In short form, UML diagrams gives you in the simplified modelling language which is equal to what you going explain in many numbers of lines on the document or so on.

For example, let’s say you are going to explain to someone (to your stakeholders) about your project and your project is called online banking system. For this, you need to write huge document which contains so much of lines and take so much of time to explain to someone. But simple UML diagram save you everything.

Let’s see how it is? The following UML use case diagram will tell you overall what the system does.

Online Banking System

What is UML?
UML stands for Unified Modelling language. This is not a programming language and it’s a modelling language.

Where UML comes from and what is the history of the UML?
Please visit www.omg.org to know more details about UML including version details and change history.

What are the different types of UML?
In UML 2.x, there are 14 types of UML diagrams and below picture shows all types which from http://en.wikipedia.org/wiki/Unified_Modeling_Language

UML

Next, our question is do we need to use all the types of diagrams for our project?
No. Its depends upon of the project and project domain type. For Information technology (IT) projects we don’t use Timing Diagram but for the manufacturing project, Timing Diagram is essentials.

What are the most commonly used UML diagrams in IT?
  1. Use Case
  2. Sequence
  3. Class
  4. Object
  5. Activity
  6. State Machine
  7. Component
  8. Package
  9. Deployment
What are the UML tools are available on the market?
There are many tools are available on the market.  Please visit http://en.wikipedia.org/wiki/List_of_Unified_Modeling_Language_tools to know more about the all tools.

Which UML tool can we use for our projects?
It’s all depends upon your taste. Recent Microsoft Visual Studio, Enterprise Architect (from Sparx Systems) and Visual Paradigm (from http://www.visual-paradigm.com) are comes with modelling project which is collaboration with source version controls systems such as TFS, SVN…etc. and more integrated with other project development tools. This is very useful for our development. Let’s say for example, some people like to buy things from Woolworths and some people from Coles but the product (say Dairy Milk) is the same.

Any books or online materials are useful for learning UML?
There are many books and information are available on the internet. If you use VS for modelling then I would suggest visiting MSDN site for more information http://msdn.microsoft.com/en-us/library/57b85fsc.aspx and I also suggest the book called UML Distilled: A Brief Guide to the Standard Object Modeling Language (3rd Edition) by Martin Fowler.

Is there any other diagrams which useful for our team?
Yes. There are other few more diagrams namely
  1. Layer
  2. Network
  3. Customize diagram which can be useful for all other purposes.
Up to here, we know little bit about UML and UML tools…etc. I would suggest lets learn first about UML notations so that we know where we can use exactly. I am not going to explain about all the notations however, I do explain the necessary notations which we need it for our modelling. I am explain with the following details for most commonly used UML diagrams
  1. Diagram name
  2. Notations
  3. When to use
  4. Who will be using
  5. Example
Let’s start with Use Case diagram.
Use Case Diagram:
  1. Diagram name: Use Case. Use Case diagram describes what system does and its does shows the overall functionalities of the systems.
  • 2.       Notations:
UseCaseNotations
UseCase

3.       When to use:  Initial phase of the project such as requirements gathering & describes the functionalities of the system.

4.       Who will be using: Technical and non-technical people.

5.       Example:

 6.       Notes:
There are two types of actors in Use Case and they are Primary and Secondary actors.
  1. Primary Actor: Who are the active participants and they are initiate the Use Case
  2. Secondary Actor:   Who are the passively participants.
  3. <Include>>:  One Use Case used by other Use Case similar like one function called by another function.
  4. <Extend>>:  Extending to another Use Case but some situations not necessarily to be extended.

Please visit the below URL’s
http://knowhow.visual-paradigm.com/uml/10-use-case-diagram-tips/ for more details about other notations and how to use them.

Sequence Diagram:
  1. Diagram name: Sequence. Sequence diagram shows the interaction between objects over specific period of the time. For each and every Use Case diagram we can draw the sequence diagram for that.
2.       Notations:
SequenceDiagram
SequenceDiagram1 
3.       When to use:  we can use the sequence diagrams when we want to look at the behaviour of the many objects with in a single Use Case.


4.       Who will be using: Technical and non-technical people.

5.       Example:

SequenceDiagramExample1

6.       Notes

Please note that messages are the important when we use the Sequence diagram and Please visit the below URL’s
for more details about messages and how to use them.

Class Diagram:
1.       Diagram name: Class. Class diagram provides an overview of the classes, objects and relationship between them. We can say class diagrams are prototype model of the target systems. Each and every Class diagram contains 3 compartments namely Class name, Attributes, Methods. 
  • + -- used to define public properties/methods
  • # -- used to define protected properties/methods
  • -   -- used to define private properties/methods
  • ~ -- used to define the package
Example:

3CompartmentsinClassDiagrams

The following 3 relationships are the very important when we draw the class diagrams.

Association: – Relation between two classes.

Composition: – A type of association represents a part of whole relationship. One part dies and other part will dies in the relationship. So simply, one cannot exist without another.

Aggregation: - A type of association represents a part of whole relationship. However one part lives without other part in the relationship.

Example:

3Classrelationships

Here, Company cannot exist without groups. This relation is called Composition and the symbol is filled diamond. We can say this relation is a strong relationship.

Employee leaves the company and Groups still exists. This relation is called Aggregation and symbol is diamond. We can say this relation is a part of relationship and it’s not strong relationship.

Multiplicity: Represents the multiple associations or one class links to many other classes.

0..1
No instances, or one instance (optional, may)
1
Exactly one instance
0..* or *
Zero or more instances
1..*
One or more instances (at least one)

Example:

MultiplicityInClassDiagrams

Here, Customer has zero or more orders.

Generalization & Specialization: Defines the parent and child relationships.

Example:

GeneralizationSpecialization

Abstract Class: Abstract class are represented by with in {abstract}  as shown in the below picture.

AbstractClass

2         Notations:

ClassDiagram
ClassDiagram1

3         When to use:  we can use the class diagrams when we want to represents the relationship between classes and objects.

4         Who will be using: Technical people.

5         Example:

ClassDiagramExample1

6         Notes:

Please visit the below URL’s
for more details about other notations and how to use them.

Object Diagram:

1. Diagram name: Object. Object diagram shows the how classes are looks when object are created for that class. It’s similar like class diagram and the same notations can be used in the object diagram and used to illustrate an instance of a class at a particular point in time.

2.  Notations:
ObjectDiagram

3.       When to use:  we can use the object diagrams when we want to create the instances of the classes and it does show how the class looks.

4.       Who will be using: Technical people.

5.       Example:

ObjectDiagramExample1

6.       Notes:

Please note that its similar like class diagram and top of that it does shows the instance of the classes. Please visit the below URL’s
for more details about object diagrams and how to use them.

Activity Diagram:

1. Diagram name: Activity. Activity diagram used to captures the complicated flows in a system. Main notations are Start, Activity and End.
Start - activity is denoted by a dark circle.
End - activity is denoted by a dark circle inside a white circle.
Activities - denoted by simple oval rectangles.

2.       Notations:
ActivityDiagram

ActivityDiagram1
ActivityDiagram2
3.       When to use:  we can use the Activity diagrams to shows the various flows with in a systems and mainly this diagram used whenever we have complicated flows in our project.


4.       Who will be using: Technical and non-technical people.

5.       Example:
ActivityDiagramExample1

6.       Notes:
Please visit the below URL’s
http://www.visual-paradigm.com/support/documents/vpumluserguide/94/200/6713_drawingactiv.html for more details about Activity diagrams and how to use them.

State Machine or State Chart Diagram:
  1. Diagram name: State Machine. State diagram shows the object undergoing process and shows the dynamic behaviour of the object.
For example, ATM machine is best examples for this diagram. The states are when we withdraw money from ATM machine.

What is the difference between Activity and State Diagram?
State diagram shows status of the object undergoing process. It gives a clear picture of the changes in the object's state in each and every process.
For example, withdraw money from ATM machine
Card object states: Checking, Approving, Rejecting

Activity diagram is a shows the flow of activity of a process.
For example, withdraw money from ATM machine
Withdraw activities: Insert Card, Enter PIN, Check PIN, Enter amount, Check balance, withdraw money, remove card.

 2.       Notations:
StateMachineDiagram
StateMachineDiagram1

3.       When to use:  we can use the State diagrams to shows the various status of the object undergoing the process and gives you clear picture of the list of possibilities of the status.

4.       Who will be using: Technical people

5.       Example:
StateMachineDiagramExample

6.       Notes:
Please visit the below URL’s
for more details about State diagrams and how to use them.

Component Diagram:
  • 1. Diagram name: Component. Component diagram shows the different software components to be used and how they connected each other in your project.
2.       Notations:
Component

3.       When to use:  we can use the Component diagrams to shows the various software components and how they are interconnected in our project.

4.       Who will be using: Technical people

5.       Example:
ComponentDiagramExample

6.       Notes:

Please visit the below URL’s
for more details about Component diagrams and how to use the them.

Package Diagram:
  1. Diagram name: Package. Package diagram is used to specify the logical groups of classes and its related components. Technically, Package diagram maps each and every library of our project which developer in ASP.NET MVC or Java etc.
 Stereo types are mainly use in Package diagrams.

What is the stereo type and what are the commonly used stereo types in UML?
Stereotypes are a way to define various entity components in UML.
The commonly used stereo types in UML are
<<Interface>>: To represents an interface.
<<Web services>>: To represents a web service
<<Executable>>: To represents a software component which can be executable.
<<Library>>:  To represents the library
<<Database>>: To represents the database of the application.
<<ODBC>>: To represents the database connectivity.

2.       Notations:
PackageDiagrams
3.       When to use:  we can use the Component diagrams to shows the various software components and how they are interconnected in our project.

4.       Who will be using: Technical people  & deployment engineer.

5.       Example:
PackageDiagramExample

6.       Notes:
Please visit the below URL’s
for more details about Package diagrams and how to use them.

Deployment Diagram:
1.       Diagram name: Deployment. Deployment diagram shows overall view of the how software and hardware nodes in our application. Deployment diagrams will helpful when we have so many assemblies which need to be deploying which servers…etc. This diagram mainly used by deployment managers and engineers.

 2.       Notations:
DeploymentDiagrams1
DeploymentDiagrams2
3.       When to use:  we can use the Deployment diagrams for deploying which package on which server…etc. and shows that changes of single assembly affect the how many systems and where need to deploy to make sure everything is correct and its does helpful for the outage notification…etc.

4.       Who will be using: Technical people, deployment managers and engineers.

5.       Example:
DeploymentDiagramExample1

6.       Notes:
Please visit the below URL’s
for more details about Deployment diagrams and how to use them.
I hope you enjoy reading this post.
Conclusions:
  1. Please try to use relevant UML diagrams which needs for your project development and it does save you lot of time and leads the project to be successful.
  2. We can use other diagrams such as Layer and Network diagrams for our future developers and application supporters. Recent Microsoft Development Studio come with modelling project and it is collaboration tool with many futures. Please try to use them and get more benefits for your project.
  3. Now, we are expert in UML.

No comments:

Post a Comment