Copyright © tutorialspoint.

com

UML Overview

UML is a standard language for specifying, visualizing, constructing, and documenting the artifacts of software systems. UML was created by Object Management Group (OMG) and UML 1.0 specification draft was proposed to the OMG in January 1997. OMG is continuously putting effort to make a truly industry standard. UML stands for Unified Modeling Language. UML is different from the other common programming languages like C++, Java, COBOL etc. UML is a pictorial language used to make software blue prints. So UML can be described as a general purpose visual modeling language to visualize, specify, construct and document software system. Although UML is generally used to model software systems but it is not limited within this boundary. It is also used to model non software systems as well like process flow in a manufacturing unit etc. UML is not a programming language but tools can be used to generate code in various languages using UML diagrams. UML has a direct relation with object oriented analysis and design. After some standardization UML is become an OMG (Object Management Group) standard.

Goals of UML:
A picture is worth a thousand words, this absolutely fits while discussing about UML. Object oriented concepts were introduced much earlier than UML. So at that time there were no standard methodologies to organize and consolidate the object oriented development. At that point of time UML came into picture. There are a number of goals for developing UML but the most important is to define some general purpose modeling language which all modelers can use and also it needs to be made simple to understand and use. UML diagrams are not only made for developers but also for business users, common people and anybody interested to understand the system. The system can be a software or non software. So it must be clear that UML is not a development method rather it accompanies with processes to make a successful system. At the conclusion the goal of UML can be defined as a simple modeling mechanism to model all possible practical systems in today.s complex environment.

conceptual model of UML:
To understand conceptual model of UML first we need to clarify What is a conceptual model? and Why a conceptual model is at all required? A conceptual model can be defined as a model which is made of concepts and their relationships. A conceptual model is the first step before drawing a UML diagram. It helps to understand the entities in the real world and how they interact with each other. As UML describes the real time systems it is very important to make a conceptual model and then proceed gradually. Conceptual model of UML can be mastered by learning the following three major elements: UML building blocks Rules to connect the building blocks Common mechanisms of UML

Object oriented concepts:
UML can be described as the successor of object oriented analysis and design. An object contains both data and methods that control the data. The data represents the state of the object. A class describes an object and they also form hierarchy to model real world system. The hierarchy is represented as inheritance and the classes can also be associated in different manners as per the requirement. The objects are the real world entities that exist around us and the basic concepts like abstraction, encapsulation, inheritance, polymorphism all can be represented using UML. So UML is powerful enough to represent all the concepts exists in object oriented analysis and design. UML diagrams are representation of object oriented concepts only. So before learning UML, it becomes important to understand OO concepts in details. Following are some fundamental concepts of object oriented world: Objects: Objects represent an entity and the basic building block. Class: Class is the blue print of an object. bstraction: Abstraction represents the behavior of an real world entity. ncapsulation: Encapsulation is the mechanism of binding the data together and hiding them from outside world. Inheritance: Inheritance is the mechanism of making new classes from existing one. Polymorphism: It defines the mechanism to exists in different forms.

OO Analysis and Design
Object Oriented analysis can be defined as investigation and to be more specific it is the investigation of objects. Design means collaboration of identified objects. So it is important to understand the OO analysis and design concepts. Now the most important purpose of OO analysis is to identify objects of a system to be designed. This analysis is also done for an existing system. Now an efficient analysis is only possible when we are able to start thinking in a way where objects can be identified. After identifying the objects their relationships are identified and finally the design is produced. So the purpose of OO analysis and design can described as: Identifying the objects of a system. Identify their relationships. Make a design which can be converted to executables using OO languages. There are three basic steps where the OO concepts are applied and implemented. The steps can be defined as

OO Analysis --> OO Design --> OO implementation using OO languages
Now the above three points can be described in details: During object oriented analysis the most important purpose is to identify objects and describing them in a proper way. If these objects are identified efficiently then the next job of design is easy. The objects should be identified with responsibilities. Responsibilities are the functions performed by the object. Each and every object has some type of responsibilities to be performed. When these responsibilities are collaborated the purpose of the system is fulfilled. The second phase is object oriented design. During this phase emphasis is given upon the requirements and their fulfilment. In this stage the objects are collaborated according to their intended association. After the association is complete the design is also complete. The third phase is object oriented implementation. In this phase the design is implemented using object oriented languages like Java, C++ etc.

Role of UML in OO design:

¡  

UML is a modeling language used to model software and non software systems. Although UML is used for non software systems the emphasis is on modeling object oriented software applications. Most of the UML diagrams discussed so far are used to model different aspects like static, dynamic etc. Now what ever be the aspect the artifacts are nothing but objects. If we look into class diagram, object diagram, collaboration diagram, interaction diagrams all would basically be designed based on the objects. So the relation between OO design and UML is very important to understand. The OO design is transformed into UML diagrams according to the requirement. Before understanding the UML in details the OO concepts should be learned properly. Once the OO analysis and design is done the next step is very easy. The input from the OO analysis and design is the input to the UML diagrams.

UML Building Blocks

As UML describes the real time systems it is very important to make a conceptual model and then proceed gradually. Conceptual model of UML can be mastered by learning the following three major elements: UML building blocks Rules to connect the building blocks Common mechanisms of UML This chapter describes all the UML building blocks. The building blocks of UML can be defined as: Things Relationships Diagrams

(1) Things:
Things are the most important building blocks of UML. Things can be: Structural Behavioral Grouping Annotational

tructural things:
The Structural things define the static part of the model. They represent physical and conceptual elements. Following are the brief descriptions of the structural things.

Class:
Class represents set of objects having similar responsibilities.

Interface:
Interface defines a set of operations which specify the responsibility of a class.

Node: A node can be defined as a physical element that exists at run time. Behavioral things: A behavioral thing consists of the dynamic parts of UML models. Following are the behavioral things: Interaction: Interaction is defined as a behavior that consists of a group of messages exchanged among elements to accomplish a specific task.Collaboration: Collaboration defines interaction between elements. Use case: Use case represents a set of actions performed by a system for a specific goal. It defines the sequence of states an object goes through in response to events. . State machine: State machine is useful when the state of an object in its life cycle is important. Events are external factors responsible for state change. Component: Component describes physical part of a system.

Note: A note is used to render comments. . Association: Association is basically a set of links that connects elements of an UML model. There are four kinds of relationships available. It also describes how many objects are taking part in that relationship. There is only one grouping thing available: Package: Package is the only one grouping thing available for gathering structural and behavioral things. It shows how elements are associated with each other and this association describes the functionality of an application. constraints etc of an UML element. (2) Relationship : Relationship is another most important building block of UML. descriptions. Note is the only one Annotational thing available. Dependency: Dependency is a relationship between two things in which change in one element also affects the other one. and comments of UML model elements. Annotational things: Annotational things can be defined as a mechanism to capture remarks.Grouping things: Grouping things can be defined as a mechanism to group elements of a UML model together.

(3) UML Diagrams: UML diagrams are the ultimate output of the entire discussion. It basically describes inheritance relationship in the world of objects. analysts and many more. 7. relationships are used to make a complete UML diagram and the diagram represents a system. 5.com UML Architecture Any real world system is used by different users. Class diagram Object diagram Use case diagram Sequence diagram Collaboration diagram Activity diagram Statechart diagram Deployment diagram Component diagram We would discuss all these diagrams in subsequent chapters of this tutorial. UML includes the following nine diagrams and the details are described in the following chapters. 6. All the other elements are used to make it a complete one. UML plays an important role in defining different perspectives of a system. The users can be developers. business people. 8. One element describes some responsibility which is not implemented and the other one implements them. The visual effect of the UML diagram is the most important part of the entire process. 1. Realization: Realization can be defined as a relationship in which two elements are connected. 2. The better we understand the better we make the system.s perspective. This relationship exists in case of interfaces. The most important part is to visualize the system from different viewer. All the elements. So before designing a system the architecture is made with different perspectives in mind. 4. These perspectives are: Design Implementation Process Deployment . testers.Generalization: Generalization can be defined as a relationship which connects a specialized element with a generalized element. 9. 3. Copyright © tutorialspoint.

Class diagram is the most widely used structural diagram. Behavioral modeling shows the dynamic nature of the system. So the class diagram. There are three important type of UML modelings: Structural modeling: Structural modeling captures the static features of a system. A Use case represents the functionality of the system. Architectural Modeling: Architectural model represents the overall framework of the system. It represents the interaction among the structural diagrams. UML Basic Notations . deployment diagram is used to support this perspective. So the other perspectives are connected with use case. Architectural model can be defined as the blue print of the entire system. It contains both structural and behavioral elements of the system. Different diagrams are used for different type of UML modeling. UML component diagram is used to support implementation perspective. Design of a system consists of classes. They consist of the followings: Classes diagrams Objects diagrams Deployment diagrams Package diagrams Composite structure diagram Component diagram Structural model represents the framework for the system and this framework is the place where all other components exist. UML provides class diagram. UML UML Modeling Types It is very important to distinguish between the UML model. component diagram and deployment diagrams are the part of structural modeling. Deployment represents the physical nodes of the system that forms the hardware. interfaces and collaboration. But the structural model never describes the dynamic behavior of the system. Behavioral Modeling: Behavioral model describes the interaction in the system. They all represent the elements and the mechanism to assemble them. Package diagram comes under architectural modeling. Implementation defines the components assembled together to make a complete physical system.And the centre is the Use Case view which connects all these four. So the same elements as used in Design are also used to support this perspective. object diagram to support this. Process defines the flow of the system. They consist of the following: Activity diagrams Interaction diagrams Use case diagrams All the above show the dynamic sequence of flow in a system.

constructing and documenting the components of software and non software systems. Following are the list of structural things. Different notations are available for things and relationships. These are considered as the nouns of UML models. Here the Visualization is the most important part which needs to be understood and remembered by heart. fourth section is optional to show any additional components. And the UML diagrams are made using the notations of things and relationships. specifying. The diagram is divided into four parts. Objects can be anything having properties and responsibility. This is just an extension to the UML buildling block section I have discussed in previous chapter. UML notations are the most important elements in modeling. Structural Things: Graphical notations used in structural things are the most widely used in UML. Classes Interface Collaboration Use case Active classes Components Nodes Class Notation: UML class is represented by the diagram shown below. So learning notations should be emphasized from the very beginning. second one is used to show the attributes of the class. Classes are used to represent objects. The The The The top section is used to name the class. The chapter describes the UML Basic Notations in more details. . Extensibility is another important feature which makes UML more powerful and flexible. Efficient and appropriate use of notations is very important for making a complete and meaningful model.UML is popular for its diagrammatic notations. The model is useless unless its purpose is depicted properly. We all know that UML is for visualizing. third section is used to describe the operations performed by the class.

Interface is the just like a template where you define different functions not the implementation. Interface Notation: Interface is represented by a circle as shown below. When a class implements the interface it also implements the functionality as per the requirement. Collaboration Notation: Collaboration is represented by a dotted eclipse as shown below. Interface is used to describe functionality without implementation. The only difference is the name which is underlined as shown below. It has a name which is generally written below the circle.Object Notation: The object is represented in the same way as the class. So it has the same usage as the class. . It has a name written inside the eclipse. As object is the actual implementation of a class which is known as the instance of a class.

Actor is used in a use case diagram to describe the internal or external entities. Use case is used to capture high level functionalities of a system. It may contain additional responsibilities. Generally responsibilities are in a group. This notation is also used in almost all diagrams to describe the end. This notation is used in almost all diagrams. Use case Notation: Use case is represented as an eclipse with a name inside it. . Initial State Notation: Initial state is defined show the start of a process. Final State Notation: Final state is used to show the end of a process.Collaboration represents responsibilities. The usage of Initial State Notation is to show the starting point of a process. Actor Notation: An actor can be defined as some internal or external entity that interacts with the system.

Additional elements can be added wherever required. A node represents a physical component of the system. . Component is used to represent any part of a system for which UML diagrams are made. Component Notation: A component in UML is shown as below with a name inside. Active class is generally used to describe concurrent behaviour of a system. Active class is used to represent concurrency in a system. Node is used to represent physical part of a system like server. network etc.The usage of Final State Notation is to show the termination point of a process. Active class Notation: Active class looks similar to a class with a solid border. Node Notation: A node in UML is represented by a square box as shown below with a name.

Interaction is used to represent communication among the components of a system. State machine Notation: State machine describes the different states of a component in its life cycle. These features include interactions and state machines. The following diagram represents different notations used in an interaction. UML has a set of powerful features to represent the dynamic part of software and non software systems. . The notations are described in the following diagram. Interactions can be of two types: Sequential (Represented by sequence diagram) Collaborative (Represented by collaboration diagram) Interaction Notation: Interaction is basically message exchange between two UML components.Behavioural Things: Dynamic parts are one of the most important elements in UML.

Package Notation: Package notation is shown below and this is used to wrap the components of a system. Note Notation: This notation is shown below and they are used to provide necessary information of a system.State machine is used to describe different states of a system component. idle or any other depending upon the situation. In UML there is only one element available for grouping and that is package. So UML has notes notation to support this requirement. . Grouping Things: Organizing the UML models are one of the most important aspects of the design. Annotational Things: In any diagram explanation of different elements and their functionalities are very important. The state can be active.

Relationships A model is not complete unless the relationships between elements are described properly. Association is represented by a dotted line with (without) arrows on both sides. The arrow head represents the independent element and the other end the dependent element. Dependency is represented by a dotted arrow as shown below. The two ends represent two associated elements as shown below. Dependency Association Generalization Extensibility Dependency Notation: Dependency is an important aspect in UML elements. The multiplicity is also mentioned at the ends (1. The Relationship gives a proper meaning to an UML model. * etc) to show how many objects are associated. It describes the dependent elements and the direction of dependency. Association Notation: Association describes how the elements in an UML diagram are associated. . Dependency is used to represent dependency between two elements of a system. Following are the different types of relationships available in UML. In simple word it describes how many elements are taking part in an interaction.

It is parent and child relationship. Generalization is used to describe parent-child relationship of two elements of a system. semantics etc. Generalization is represented by an arrow with hollow arrow head as shown below. It is basically additional elements used to represent some extra behaviour of the system. So it is very important to understand the different diagrams to implement the knowledge in real life systems.Association is used to represent the relationship between two elements of a system. ¢ Standard Diagrams . Now we need to understand where to use those elements. The elements are like components which can be associated in different ways to make a complete UML pictures which is known as diagram. Generalization Notation: Generalization describes the inheritance relationship of the object oriented world. These diagrams have a better impact on our understanding. So if we look around then we will realize that the diagrams are not a new concept but it is used widely in different form in different industries. Extensibility Notation: All the languages (programming or modeling) have some mechanism to extend its capabilities like syntax. One end represents the parent element and the other end child element. Any complex system is best understood by making some kind of diagrams or pictures. UML is also having the following mechanisms to provide extensibility features. These extra behaviours are not coverUML In the previous chapters we have discussed about the building blocks and other necessary elements of UML. Stereotypes (Represents new elements) Tagged values (Represents new attributes) Constraints (Represents the boundaries) xtensibility notations are used to enhance the power of the language.

During design phase software artifacts (classes. Component Diagram: Component diagrams represent a set of components and their relationships. There are two broad caetgories of diagrams and then are again divided into sub-categories: Structural Diagrams Behavioral Diagrams Structural Diagrams: The structural diagrams represent the static aspect of the system. interfaces etc) of a system are arranged in different groups depending upon their relationship. So these diagrams are more close to real life scenarios where we implement a system. objects. interfaces. interfaces. This is the most widely used diagram at the time of system construction.We prepare UML diagrams to understand a system in better and simple way. So UML defines various kinds of diagrams to cover most of the aspects of a system. interfaces or collaborations. Class diagram consists of classes. Now these groups are known as components. So Component diagrams represent the implementation view of a system. component diagrams are used to visualize the implementation. You can also create your own set of diagrams to meet your requirements. Object diagrams are a set of objects and their relationships just like class diagrams and also represent the static view of the system. These static aspects represent those parts of a diagram which forms the main structure and therefore stable. So it is generally used for development purpose. components and nodes. The four structural diagrams are: Class diagram Object diagram Component diagram Deployment diagram Class Diagram: Class diagrams are the most common diagrams used in UML. associations and collaboration. Object Diagram: Object diagrams can be described as an instance of class diagram. Class diagrams basically represent the object oriented view of a system which is static in nature. Finally. These components consist of classes. Class diagram represents the object orientation of a system. Active class is used in a class diagram to represent the concurrency of the system. A single diagram is not enough to cover all aspects of the system. These static parts are represents by classes. Diagrams are generally made in an incremental and iterative way. . The usage of object diagrams is similar to class diagrams but they are used to build prototype of a system from practical perspective.

A use case represents a particular functionality of a system. So use case diagram is used to describe the relationships among the functionalities and their internal/external controllers. Deployment diagrams are used for visualizing deployment view of a system. actors and their relationships. This is generally used by the deployment team. Collaboration Diagram: Collaboration diagram is another form of interaction diagram. From the name it is clear that the diagram deals with some sequences. So a model is considered as complete when both the aspects are covered fully. Behavioral Diagrams: Any system can have two aspects. So Sequence diagram is used to visualize the sequence of calls in a system to perform a specific functionality. The purpose of collaboration diagram is similar to sequence diagram. Note: If the above descriptions and usages are observed carefully then it is very clear that all the diagrams are having some relationship with one another. These controllers are known as actors. interfaces etc which are part of class/object diagram. Again the deployment diagram is dependent upon the components which are used to make a component diagrams. Sequence Diagram: A sequence diagram is an interaction diagram. UML has the following five types of behavioral diagrams: Use case diagram Sequence diagram Collaboration diagram Statechart diagram Activity diagram Use case Diagram: Use case diagrams are a set of use cases. But the specific purpose of collaboration diagram is to visualize the organization of objects and their interaction. which are the sequence of messages flowing from one object to another. Structural organization consists of objects and links. . These nodes are physical entities where the components are deployed. It represents the structural organization of a system and the messages sent/received.Deployment Diagram: Deployment diagrams are a set of nodes and their relationships. Behavioral diagrams basically capture the dynamic aspect of a system. static and dynamic. Dynamic aspect can be further described as the changing/moving parts of a system. They represent the use case view of a system. Component diagrams are dependent upon the classes. Interaction among the components of a system is very important from implementation and execution perspective.

So it is the most popular UML diagram in the coder community. describing and documenting different aspects of a system but also for constructing executable code of the software application. concurrent or branched. These events are responsible for state change of the system. The class diagram describes the attributes and operations of a class and also the constraints imposed on the system. interfaces. Class diagram is not only used for visualizing. Purpose: The purpose of the class diagram is to model the static view of an application. sequence diagram can only give the sequence flow of the application but class diagram is a bit different. Activities are nothing but the functions of a system. The class diagrams are widely used in the modelling of object oriented systems because they are the only UML diagrams which can be mapped directly with object oriented languages. collaborations and constraints.Statechart Diagram: Any real time system is expected to be reacted by some kind of internal/external events. It is also known as a structural diagram. Statechart diagram is used to represent the event driven state change of a system. It basically describes the state change of a class. The class diagrams are the only diagrams which can be directly mapped with object oriented languages and thus widely used at the time of construction. associations. State chart diagram is used to visualize the reaction of a system by internal/external factors. So UML has provided features to capture the dynamics of a system from different angles. Describe responsibilities of a system. Activity diagrams are used to visualize the flow of controls in a system. So the purpose of the class diagram can be summarized as: Analysis and design of the static view of an application. Note: Dynamic nature of a system is very difficult to capture. interface etc. UML Class Diagram Overview: The class diagram is a static diagram. Sequence diagrams and collaboration diagrams are isomorphic so they can be converted from one another without losing any information. Activity Diagram: Activity diagram describes the flow of control in a system. ed by the standard available notations. The flow can be sequential. The class diagram shows a collection of classes. It represents the static view of an application. The UML diagrams like activity diagram. This is prepared to have an idea of how the system will work when executed. Numbers of activity diagrams are prepared to capture the entire flow in a system. So it consists of activities and links. . This is also true for statechart and activity diagram.

Because unnecessary properties will make the diagram complicated. the diagram should be drawn on plain paper and rework as many times as possible to make it correct. Forward and reverse engineering. The following points should be remembered while drawing a class diagram: The name of the class diagram should be meaningful to describe the aspect of the system. Now the following diagram is an example of an Order System of an application. So it is very important to learn the drawing procedure of class diagram. So the following class diagram has been drawn considering all the points mentioned above: . How to draw Class Diagram? Class diagrams are the most popular UML diagrams used for construction of software applications. Responsibility (attributes and methods) of each class should be clearly identified.Base for component and deployment diagrams. before making the final version. So it describes a particular aspect of the entire application. Because at the end of the drawing it should be understandable to the developer/coder. Finally. First of all Order and Customer are identified as the two elements of the system and they have a one to many relationship because a customer can have multiple orders. For each class minimum number of properties should be specified. Use notes when ever required to describe some aspect of the diagram. Class diagrams have lot of properties to consider while drawing but here the diagram will be considered from a top level view. So a collection of class diagrams represent the whole system. In addition they have additional functions like dispatch () and receive (). Each element and their relationships should be identified in advance. The two inherited classes have all the properties as the Order class. Class diagram is basically a graphical representation of the static view of the system and represents different aspects of the application. We would keep Order class is an abstract class and it has two concrete classes (inheritance relationship) SpecialOrder and NormalOrder.

Class diagram clearly shows the mapping with object oriented languages like Java. So from practical experience class diagram is generally used for construction purpose. Generally UML diagrams are not directly mapped with any object oriented programming languages but the class diagram is an exception. So only static behaviour is not sufficient to model a system rather dynamic behaviour is more important than static behaviour. The static view describes the vocabulary of the system.Where to use Class Diagrams? Class diagram is a static diagram and it is used to model static view of a system. dynamic behaviour means the behaviour of the system when it is running /operating. In UML there are five diagrams available to model dynamic nature and use case diagram is one . Describing the functionalities performed by the system. Construction of software applications using object oriented languages. Class diagrams are not only used to visualize the static view of the system but they are also used to construct the executable code for forward and reverse engineering of any system. Class diagram is also considered as the foundation for component and deployment diagrams. To clarify a bit in details. class diagrams are used for: Describing the static view of the system. UML Use Case Diagram Overview: To model a system the most important aspect is to capture the dynamic behaviour. So in a brief. Showing the collaboration among the elements of the static view. C++ etc.

use cases and their relationships. These internal and external agents are known as actors. So to model the entire system numbers of use case diagrams are used. So when a system is analyzed to gather its functionalities use cases are prepared and actors are identified. So when the requirements of a system are analyzed the functionalities are captured in use cases. Use case diagrams are used to gather the requirements of a system including internal and external influences. So if we look into the diagram then we will find three use cases (Order. Actors can be defined as something that interacts with the system. So in brief. The diagram is used to model the system/subsystem of an application. Functionalities to be represented as an use case Actors Relationships among the use cases and actors. collaboration and Statechart) are also having the same purpose. So in a brief when we are planning to draw an use case diagram we should have the following items identified. Now as we have to discuss that the use case diagram is dynamic in nature there should be some internal or external factors for making the interaction. Show the interacting among the requirements are actors. The following is a sample use case diagram representing the order management system. Identify external and internal factors influencing the system. How to draw Component Diagram? Use case diagrams are considered for high level requirement analysis of a system. The actors can be human user. A single use case diagram captures a particular functionality of a system. But this definition is too generic to describe the purpose. some internal applications or may be some external applications. Because the main purpose of the diagram is to identify requirements. The name of a use case is very important. Purpose: The purpose of use case diagram is to capture the dynamic aspect of a system. Now the second things which are relevant to the use cases are the actors. These requirements are mostly design requirements. Do not try to include all types of relationships. Use note when ever required to clarify some important points. Now when the initial task is complete use case diagrams are modelled to present the outside view. Use case diagrams are drawn to capture the functional requirements of a system. sequence. the purposes of use case diagrams can be as follows: Used to gather requirements of a system. So the name should be chosen in such a way so that it can identify the functionalities performed. Show relationships and dependencies clearly in the diagram. So use case diagrams are consists of actors.of them. . Used to get an outside view of a system. Because other four diagrams (activity. So we can say that uses cases are nothing but the system functionalities written in an organized manner. SpecialOrder and NormalOrder) and one actor which is customer. So after identifying the above items we have to follow the following guidelines to draw an efficient use case diagram. So we will look into some specific purpose which will distinguish it from other four diagrams. Give a suitable name for actors.

The SpecialOrder and NormalOrder use cases are extended from Order use case. Use case diagram is one of them and its specific purpose is to gather system requirements and actors. Although the use cases are not a good candidate for forward and reverse engineering but still they are used in a slight different way to make forward and reverse engineering. Now each and every model has some specific purpose to use. UML Activity Diagram . So they have extends relationship. Then this high level design is refined again and again to get a complete and practical picture of the system. So the following are the places where use case diagrams are used: Requirement analysis and high level design. Use case diagrams specify the events of a system and their flows. And these extra elements are used to make test cases when performing the testing. Use case diagram can be imagined as a black box where only the input. Model the context of a system. In forward engineering use case diagrams are used to make test cases and in reverse engineering use cases are used to prepare the requirement details from the existing application. Another important point is to identify the system boundary which is shown in the picture. Where to use Deployment Diagrams? As we have already discussed there are five diagrams in UML to model dynamic view of a system. output and the function of the black box is known. So to understand the dynamics of a system we need to use different types of diagrams. Actually these specific purposes are different angles of a running system. These diagrams are used at a very high level of design. A well structured use case also describes the pre condition. exceptions. The actor Customer lies outside the system as it is an external user of the system. Forward engineering. post condition. But use case diagram never describes how they are implemented. Reverse engineering. Still use case diagram is used differently to make it a candidate for reverse engineering. And the same is true for reverse engineering.

Other four diagrams are used to show the message flow from one object to another but activity diagram is used to show message flow from one activity to another. Although the diagrams looks like a flow chart but it is not. Activity diagrams are not only used for visualizing dynamic nature of a system but they are also used to construct the executable system by using forward and reverse engineering techniques. So before drawing an activity diagram we should identify the following elements: Activities Association Conditions Constraints Once the above mentioned parameters are identified we need to make a mental layout of the entire flow. This flow can be sequential. It captures the dynamic behaviour of the system. These additional capabilities include branching. The activity diagram is made to understand the flow of activities and mainly used by the business users. An activity is a function performed by the system. branched or concurrent. Before drawing an activity diagram we must have a clear understanding about the elements used in activity diagram. But activity diagram are not exactly a flow chart as they have some additional capabilities. It shows different flow like parallel. The following is an example of an activity diagram for order management system. Describe the sequence from one activity to another. After identifying the activities we need to understand how they are associated with constraints and conditions. So the control flow is drawn from one operation to another. swimlane etc. Purpose: The basic purposes of activity diagrams are similar to other four diagrams. The main element of an activity diagram is the activity itself. It does not show any message flow from one activity to another. concurrent and single. In the diagram four activities are identified which are associated with conditions. Activity diagram is some time considered as the flow chart. So the purposes can be described as: Draw the activity flow of a system. This mental layout is then transformed into an activity diagram. Describe the parallel. One important point should be clearly understood that an activity diagram cannot be exactly matched with the code. The only missing thing in activity diagram is the message part. The following diagram is drawn with the four main activities: .Overview: Activity diagram is another important diagram in UML to describe dynamic aspects of the system. How to draw Component Diagram? Activity diagrams are mainly used as a flow chart consists of activities performed by the system. join etc. branched and concurrent flow of the system. Activity diagrams deals with all type of flow control by using different elements like fork. parallel flow. Activity is a particular operation of the system. The activity can be described as an operation of the system. branched. Activity diagram is basically a flow chart to represent the flow form one activity to another activity.

These systems can be database.Send order by the customer Receipt of the order Confirm order Dispatch order After receiving the order request condition checks are performed to check if it is normal or special order. After the type of order is identified dispatch activity is performed and that is marked as the termination of the process. Following are the main usages of activity diagram: Modeling work flow by using activities. external queues or any other system. An application can have multiple systems. This specific usage is not available in other diagrams. Investigate business requirements at a later stage. This high level view is mainly for business users or any other person who is not a technical person. This diagram is used to model the activities which are nothing but business requirements. From the above discussion it is clear that an activity diagram is drawn from a very high level. The activity diagram is suitable for modeling the activity flow of the system. The specific usage is to model the control flow from one activity to another.UML Tutorial 2. So the diagram has more impact on business understanding rather implementation details. Modeling business requirements. Visual Case Tool . The Use Case Diagram . So it gives high level view of a system. Where to use Interaction Diagrams? The basic usage of activity diagram is similar to other four UML diagrams. High level understanding of the system's functionalities. Activity diagram also captures these systems and describes flow from one system to another. Now we will look into the practical applications of the activity diagram. This control flow does not include messages.

you can specify the steps of a use case in its description field. The use case brings scenarios together that accomplish a specific goal of the user. A use case can be specified by textually describing the steps required and any alternative actions at each step.In many design processes. the use case diagram is the first that designers will work with when starting a project. For example. Includes . the actors are shown as the green stick figure shapes on the left. Associations On a use case diagram. The 4. the use case for searching a web for a keyword might be shown as: 1. Use Case More formally. support person. the report and the diagrams will include all of the details of the use case . manager. In the above diagram. Each scenario is a sequence of steps that encompass an interaction between a user and a system.their specific scenarios and the actors that carry them out. Customer 2. the use cases are the blue ellipses. Examples of actors are salesperson. A use case can be carried out by many actors and an actor may carry out many use cases. When creating a use case model. we are not concerned with the individuals. but only the developer creates the model. Together. and the associations between them are represented by the connecting lines. This diagram allows for the specification of high level user goals that the system must carry out. Customer 3. associations are drawn between actors and use cases to show that an actor carries out a use case. and web store system. but can be more general required functionality of the system. It is possible that the same person may be a sales person and also provide support. It is important to distinguish between a user and an actor (better thought of as a role). her or its job (since an actor may be another system). a use case is made up of a set of scenarios. Actor The use case diagram allows a designer to graphically show these use cases and the actors that use them. A user of the system may play several different roles through the course of his. Simply right-click on a use case and select properties. The developer and the stakeholder both are responsible for specifying the system roles. only the roles that they play. These goals are not necessarily tasks or actions. You can then run a report and print or export the results to html or ascii text. The results are shown enters clicks search the is the search keyword button executed Alternative: Search If the search fails at 3. then the user is redirected back to the search screen at step 1 Failed In Visual Case. An actor is a role that a user plays in the system.

less cluttered diagrams are easier to understand. The extends link is more controlled than the generalization link in that functionality can only be added at the extension points. the use case limit exceeded describes a situation in which the usual scenario of online purchase is not performed. it is very important to keep it simple. In general. Generalization When a use case describes a variation on another use case. search by name is said to extend search at the name extension point. however simpler. Use cases that generalize another use case should only specify an alternative. Extends In some instances you want to describe a variation on behaviour in a more controlled form. In the example below. The diagram below shows the use of the includes link. Often it is easiest to first determine the actors of the system.Use cases can also be related to each other with three different links. and are often more powerful in capturing the tasks of the system. Putting it all Together When starting a use case model. Both invoice purchase and online purchase include the scenarios defined by purchase valuation. even exceptional. In the example below. scenario to the use case being generalized. and then flush out the use cases that they perform. Your use case diagrams can be as simple or complex as you wish. the includes link is to avoid repetition of scenarios in multiple use cases. In such instances you can define extension points in the extended use case. The overall goal of the use cases should be the same. . use a generalization link.

Centre: The centre section contains the attributes of the class. Your use case design should be simple and help to clarify the user's goals and expectations for the system. you can explode a use case into a new use case diagram. The Class Diagram The class diagram is core to object-oriented design. Each package can contain any type and any number of other UML diagrams. as well as interfaces and classes. It describes the types of objects in the system and the static relationships between them. You can optionally assign a stereotype to a class. packages serve a similar. Packages Packages allow you to break up a large number of objects into related groupings. package and stereotype are shown in the upper section of the class. Visual Case Tool . classes shown on a diagram that do not belong to the same package as the diagram are shown with their entire path name. In Visual Case. not an atomic programming operation. Classes are divided into three sections: Top: The name. In many object oriented languages (such as Java). In the UML. packages are used to provide scope and division to classes and interfaces. Classes The core element of the class diagram is the class. Any UML diagram in Visual Case can have packages on them. entities that often relate to real world objects. the use case online purchase may require further specification as you move into the design. The Contact class above is an example of a simple class that stores location information. but broader purpose. Bottom: In the lower section are the operations that can be performed on the class. Remember that a use case represents a goal of a user.UML Tutorial 3. classes are used to represent entities within the system. In an object oriented system.In Visual Case. You can create a sub-diagram within any use case to help clarify and understand the tasks involved. . For example.

Static: attributes that are static only exist once for all instances of the class. It is generally understood that when implementing the class. a country and a postal code. Final: if an attribute is declared final. if we set city to be static. Visual Case allows you to specify the following properties for an attribute: Array: you can set an attribute to be treated as an array of attributes. any time we used the Contact class the city attribute would always have the same value. The most common exception to this preference are constants. datatype and default value. it is generally preferred to keep most attributes private as the accessor methods allow you to control access to the data. Attributes An attribute is a property of a class. The attribute is a constant. you can optionally shown and hide both the attribute and operations sections of all the classes or individual classes. Operations The operations listed in a class represent the functions or tasks that can be performed on the data in the class. a province. visibility. Methods to set and retrieve attribute data are often called accessor methods (also getting and setting methods) and need not be shown in your model as they are usually inferred. In the example above. shown with square braces [ ] beside the name. we are told that a Contact has an address. In the example above. This is useful as often you will want your class diagrams to highlight specific constructs of your system that superfluous information only serves to clutter and confuse. functionality is provided to set and retrieve the information stored in attributes. In addition to the name. a city. The format for attributes is: visibility name: type = defaultValue The visibility is as follows: + # ~ Private Public Protected Package In object oriented design.On any Visual Case class diagram. . it's value cannot be changed.

city.. we again see our Contact class. The format for operations is: visibility name (parameters): type The format is very similar to that of the attribute except with the removal of a default value and the addition of parameters. there is one attribute (a private array of Objects) and three operations.) to indicate that parameters exist.In the List class above. If the list is hidden and an operation has parameters. inout or it can be unspecified. but with more information added. but adds to them in some way. out.. . In each of Client and Company all of the attributes in Contact (address. In the above diagram. Generalization The generalization link is used between two classes to show that a class incorporates all of the attributes and operations of another. only now with two child classes. Sometimes operations have numerous parameters that need not be shown all the time. etc. but are hidden. three dots are shown (. In the above situation Contact is said to be the superclass of Client and Company. We can say that Client and Company inherit. generalize or extend Contact. Parameters take the format: direction name: type = default value The direction can be one of in.) exist. In Visual Case you can show and hide the parameter list for a class or all classes on a diagram.

The key is to keep your diagrams as clear as possible. Essentially. but define a new implementation for it. . Above. the child classes have the option to override the operations in the parent class. you may wish to specify all of the methods that are overriden. OntarioTaxCalculator redefines or overrides the implementation of the method in BasicTaxCalculator. Not all of the operations in an abstract class have to be abstract. the class itself is considered abstract. For example. Sometimes you may want to force children to override methods in a parent class. The abstract operation calculateTaxes in AbstractTaxCalculator must be implemented in the child classes OntarioTaxCalculator and NovaScotiaTaxCalculator.When using a generalization link. Abstract methods and classes are shown in italics. Since the operations must be implemented. If a class has abstract operations. they can include an operation that is defined in the superclass. That is. In the above instance the diagram is simple and the meaning clear. In this case you can define the methods in the superclass as abstract. it is not necessary to show them in the child classes. the code is different but the operation is called the same way. Interfaces Many object oriented programming languages do not allow for multiple inheritance. however you may if you choose. however with multiple levels of inheritance and more attributes and operations. The interface is used to solve the limitations posed by this. in the earlier class diagram Client and Company both generalize Contact but one or the other child classes may have something in common with a third class that we do not want to duplicate in multiple classes.

* 1. The Company class has two attributes that reference the Client class.2. 10. we could not also allow it to generalize Sortable. unlike a class. Instead. Because Product already generalizes Contact.The interface Sortable. Multiplicities can be anything you specify. There is one contact person in a single Company.. is used in the above example to show that both Company and Product implement the sort operation. The first association (the top one) represents the old contactPerson attribute. Associations Classes can also contain references to each other. two or ten and above but no . As well. We can say that Company and Product implement Sortable or that they are Sortable. we made Sortable an interface and added a realization link to show the implementation.. The multiplicity of the association is one to one meaning that for every Companythere is one and only one contactPerson and for each contactPerson there is one Company. In the bottom association there are zero or many employees for each company. The above two associations have the same meaning as the attributes in the old version of the Contact class. Some examples are shown: 0 1 1. it is sometimes more expressive to show the attributes as associations.. Although this is perfectly correct. The child classes Company and Product are forced to implement the sort operation in its entirety. all of the operations in an interface have no implementation. Interfaces are very similar to abstract classes with the exception that they do not have any attributes.* zero one one or many one.

generalizations. If you have trouble remembering the difference between composition and aggregation. the dependencies may be too numerous to specify. The most important thing about design is to not let it bog you down with detail. That is not to say that numerous dependencies are okay. but the Client class does not have any knowledge of the Company. overly complex diagrams. If for example. operations. then a dependency exists between the two. If we were designing a tax system for the United States and we tried to show all of the states. It is more clear. If a PurchaseOrder is destroyed. The aggregation association is represented by the hollow diamond. just think of the alphabet. Fortunately class diagrams closely relate to the most object oriented languages.through nine The arrows at the end of the associations represent their navigability. so the basics (classes. the Products within the group are destroyed as well. Dependencies can exist between any components in the UML however at the highest level. . You can set the navigability on either. Previously we saw the AbstractTaxCalculator that was generalized by OntarioTaxCalculator and NovaScotiaTaxCalculator. you may wish to draw a Package Diagram. The composition association is represented by the solid diamond. Within a package. Even within a package you want to limit the dependencies. attributes. the goal is to minimize dependencies. To help clarify the dependencies in your design. In the above examples. a class calls an operation in another class. however between packages in particular you should be strict about the number of dependencies that exist. If you change the operation. neither or both ends of your associations. Start with what you know and then move on. In general. PurchaseOrder is an aggregate of Products. It is said that ProductGroup is composed of Products. A package diagram is essentially a class diagram with only packages and dependencies showing. and just as expressive to show two or three child classes and add a note to the diagram the explains that the other provinces and territories are implemented in the same way. This means that if a ProductGroup is destroyed. etc. dependencies will exist between packages. the Company references Clients. It is better to have a few clear diagrams than many. Dependencies A dependency exists between two elements if changes to one will affect the other. the Products still exist. If we tried to create a diagram with all ten Canadian provinces and the three territories we would have a huge complex mess. than the dependent class will have to change as well. Composition means destroy and the letters 'c' and 'd' are next to each other. we would be in even more trouble. When designing your system. the fewer the dependencies the more scaleable and maintainable your system will be. Putting it all Together Class diagrams really are the core of most object oriented design so you will likely find yourself using them all the time. If there is no navigability shown then the navigability is unspecified. Aggregation and Composition The above example shows an aggregation association and a composition association.) should be fairly easy to grasp.

Simply put. . There can be any number of incoming. The top diamond is a branch and has only one transition flowing into it and any number of mutually exclusive transitions flowing out. Activity and State Diagrams Previously we saw how interaction diagrams demonstrate the behaviour of several objects when executing a single use case. you'll want to keep your design in synch with your implementation. The merge is used to end the conditional behaviour. but has added support for parallel execution as well. Transitions are directed arrows flowing from the previous activity to the next activity. Activity Diagram An activity is the execution of a task whether it be a physical activity or the execution of code. activity diagrams have support for conditional behaviour. as the system is implemented and upgraded. Like the simple flow chart. the activity diagram shows the sequence of activities. This will be far easier with a simple design of the key concepts of the system. the guards on the outgoing transitions must resolve themselves so that only one is followed. The label is also optional and is freeform. Visual Case Tool . and only one outgoing transition.Keeping your designs simple will allow you to be more productive as well as making your designs far more understandable and useable. That is. When you want to show the sequence of events on a broader scale use activity and state diagrams. To show conditional behaviour use a branch and a merge.UML Tutorial 5. Also. End: each activity diagram has one finish at which the sequence of actions ends Activity: activities are connected together by transitions. Start: each activity diagram has one start (above) at which the sequence of actions begins. They are optionally accompanied by a textual label of the form: [guard] label The guard is a conditional expression that when true indicates that the transition is taken.

Only a subset of the available diagram notations in UML is used. The join (bottom) represents the end of the parallel behaviour and has any number of transitions entering. is available in EG 202 872. . Use Case diagram Sequence diagram Activity diagram Object diagram Class diagram Use Case diagram The creation of a use case model is an excellent vehicle for elicitation of functional requirements. Authorized user). The use case diagram above describes what services (use cases) that are available for different categories of users (PUM user. all of which will be taken. a sequence diagram is one of the possible diagram kinds to choose from in UML. The fork (top) has one transition entering and any number of transitions exiting. When making sequence diagrams. you focus on describing the sequences of message interactions between communicating entities. and only one leaving. The complete case study. as well as the methodology for creating the UML models. The activity consists of identifying use cases and actors and describing the details of each use case.To show parallel behaviour use a fork and a join. TOP Sequence diagram When describing the details of a use case (service). UML > UML Example The UML diagram examples below are all created in the case study of describing the QSIG Private User Mobility Registration (PUMR) service in UML.

internal to the system or system part. . Home) interacts by message interchange in order to carry out the service.The sequence diagram above describes how the actor (PUM User) initiates the de-registration use case and how the distributed system entities (Visitor. TOP Activity diagram Activity diagrams is another way to describe use case behaviour. focussing on how the behaviour can be broken down in functions.

This may for example include y system parts and their relation y system data y interfaces of communicating parts y messages and operations of interfaces .The activity diagram above describes in what order different functions should be carried out and. TOP Class diagram Class diagrams typically describe the different entities of a system as classes and the relation between these. if they are optional. under what circumstances the functions should be invoked.

.The class diagram above describes the communicating entities of the PUMR model (Home PINX. Visitor PINX. Directory PINX) and the interfaces with operations/messages that these entities must realize.

The object diagram above describes how the communicating entities in the PUMR system environment relate and the means for communication that exist. TOP Object diagram The object diagram puts the classes in the class diagrams into context and shows how individual instances of classes relate to each other.The class diagram above shows the different setup messages of the PUMR model and the data these messages carry. .

Sign up to vote on this title
UsefulNot useful