UML FAQS

Diagram :

A diagram is a graphical presentation of a collection of model elements. This presentation is a projection of those elements of a given model.

Most UML diagrams show model elements as vertices and  the relationships among those elements as arcs.

The UML defines nine types of diagrams: 

·         use case diagram
·         class diagram
·         object diagram
·         activity diagram
·         sequence diagram
·         statechart diagram
·         collaboration diagram
·         component diagram
·         deployment diagram

Use Case Diagrams
Use case diagrams model the functionality of system using actors and use cases.

Class Diagrams
Class diagrams are the backbone of almost every object oriented method, including UML. They describe the static structure of a system.

Object Diagrams
Object diagrams describe the static structure of a system at a particular time. They can be used to test class diagrams for accuracy.

Activity Diagrams
Activity diagrams illustrate the dynamic nature of a system by modeling the flow of control from activity to activity. An activity represents an operation on some class in the system that results in a change in the state of the system. Typically, activity diagrams are used to model workflow or business processes and internal operation.

Sequence Diagrams
Sequence diagrams describe interactions among classes in terms of an exchange of messages over time.

Statechart Diagrams
Statechart diagrams describe the dynamic behavior of a system in response to external stimuli. Statechart diagrams are especially useful in modeling reactive objects whose states are triggered by specific events.

Collaboration Diagrams
Collaboration diagrams represent interactions between objects as a series of sequenced messages. Collaboration diagrams describe both the static structure and the dynamic behavior of a system.

Component Diagrams
Component diagrams describe the organization of physical software components, including source code, run-time (binary) code, and executables.

Deployment Diagrams
Deployment diagrams depict the physical resources in a system, including nodes, components, and connections.

What is Association ?
When classes are connected together conceptually, that connection is called an association.


When one class associates with another, each one usually plays a role within that association. You can show those roles on the diagram by writing them near the line next to the class that plays the role.

Association may be more complex than just one class connected to another. Several classes can connect to one class.
Sometimes an association between two classes has to follow a rule. You indicate that rule by putting a constraint near the association line.

Just like a class, an association can have attributes and operations. In this case we have an association class.


You visualize association class the same way you show a regular class, and you use dotted line to connect it to the association line.
Multiplicity is a special type of association which shows the number of objects from one class that relate with a number of objects in an associated class.




One class can be relate to another in a
one-to-one
one-to-many
one-to-one or more
one-to-zero or one
one-to-a bounded interval (one-to-two through twenty)
one-to-exactly n
one-to-a set of choices (one-to-five or eight)

The UML uses an asterisk (*) to represent more and to represent many.

Sometimes, a class is in association with itself. This can happen when a class has objects that can play a variety of roles. These associations are called reflexive associations.



NOTE : Inheritance is a kind of Association.

NOTE : Classes that provide no objects are said to be abstract classes. You indicate an abstract class by writing its name in italics.

Visibility
Visibility applies to attributes or operations, and specifies the extent to which other classes can use a given class's attributes or operations.

Three levels of visibility are possible (last symbols are used in UML classes to indicate different levels of visibility):

         Levels
 Explanation
     Notation
Public  level
usability extends to other classes
           +
Protected level
usability is open only to classes that inherit from original class

           #
Private level
only the original class can use the attribute or operation

           -


What is the difference between Aggregation and Composition ?

Aggregation is represented as a hierarchy with the "whole" class at the top, and the component below. A line joins a whole to a component with an open diamond on the line near the whole.



 

An aggregation association in the TV Set system


A composite is a strong type of aggregation. Each component in a composite can belong to just one whole. The symbol for a composite is the same as the symbol for an aggregation except the diamond is filled.



 A composite association. In this association each component belongs to exactly one whole.

Interfaces and Realizations

An interface is a set of operations that specifies some aspect of a class behaviour, and it's a set of operations a class presents to other classes.

You model an interface the same way you model a class, with the rectangle icon, but interface has no attributes, only operations. Another way is with a small circle joined with line to a class.

An interface is a collection of operations that a class carries out.

To distinguish interfaces from classes, in stereotype construct we put <> or I at the begining of the name of any interface.



The relationship between a class and an interface is called realization. This relationship is modeled as a dashed line with a large open triangle adjoining and pointing to the interface.



 
Sequence Diagrams :

The sequence diagram consists of objects represented in the usual way - as named rectangles (with the name underlined), messages represented as solid-line arroes, and time represented as a vertical progression.

Objects
The objects are laid out near the top of the diagram from left to right. They're arranged in any order that simplifies the diagram. Extending downforward from each object is a dashed line called the object's lifeline. Along the lifeline is narrow rectangle called an activation. The activation represents an execution of an operation the object carries out. The length of the rectangle signifies the activation's duration. This is shown on next picture.

Representing an object in a sequence diagram


Messages
A message that goes from one object to another goes from one object's lifeline to the other object's lifeline. An object can send a message to itself-that is, from its lifeline back to its own lifeline. This is called recursion. See recursion example.

Following table lists all of possible messages existing in the UML sequence diagrams, with their graphical representations:



 

Simple
This is a transfer of control from one object to another.


Synchronous

If an object sends a synchronous message, it waits for an answer to that message before it proceeds with its business.

      
Asynchronous

If an object sends an asynchronous message, it doesn't wait for an answer before it proceeds.

       

Time

The diagram represents time in the vertical direction. Time starts at the top and progresses toward the bottom. A message that's closer to the top occurs earlier in time than a message that's closer to the bottom.




The essential symbol set of the sequence diagram, with the symbols working together.

NOTE : The actor-symbol initiates the sequence, but the stick figure isn't part of the sequence diagram symbol set.

In a sequence diagram, the objects are laid out from left to right across the top. Each object' lifeline is a dashed line extending downward from the object. A solid line with an arrowhead connects one lifeline to another, and represents a message from one object to another. Time starts at the top an proceeds downward. Although an actor typically initiates the sequence, the actor symbol isn't part of the sequence diagram's symbol set.


0 comments:

Post a Comment