Thursday, January 8, 2009

UML - Diagrams Required


Here this article covers the major inputs for UML.

  • Diagrams required in various phases of s/w development

Diagrams required in various phases:

Here we’ll see what diagrams are required to sketch in the various phases of s/w development.

  • Not all diagrams are compulsory.
  • The minimum diagrams according to software life cycle phases are :-

    • Requirement phase: - Use Case Diagrams, Activity Diagrams
    • Design Phase: - Component diagrams, Class diagrams
    • Implementation phase: - All diagrams derived from pervious phases specially class diagram for reverse engineering.
    • Testing phase: - All diagrams derived from requirement and design phases for verification and preparing test plans.
    • Roll out and close over phase: - All document derived from Design phase and requirement phases.

Below is a sample figure which shows all the documents in relevant phases.

Requirement phase (Use Case Diagrams, Activity diagrams)

Use Case Diagrams
<![if !supportLists]>·         <![endif]>These are required to be developed in Requirement phase.
<![if !supportLists]>·         <![endif]>Requirement phase is the phase where you normally gather requirement and Use Cases are the best things to make explanation of the system.

<<include>> - Shows a necessary connection between Use Cases.
<<exclude>> - Shows an optional behaviour for a Use Case.

<![if !supportLists]>·       <![endif]>Inputs -

<![if !supportLists]>-          <![endif]>Identify ‘VERBS’ in a system. These verbs will be Use Cases.
<![if !supportLists]>-          <![endif]>E.g. For a Washing Machine system, Use Cases can be –, Wash Clothes, Rinse Clothes & Dry Clothes

<![if !supportLists]>-          <![endif]>Find out possible Use Cases
<![if !supportLists]>-          <![endif]>Find out possible Actors
<![if !supportLists]>-          <![endif]>Depict interaction among each Actor and Use Case
<![if !supportLists]>-          <![endif]>Detail each Use Case in terms of Scenarios
<![if !supportLists]>-          <![endif]>Find out the relationship among various Use Cases.

Activity Diagrams
<![if !supportLists]>·       <![endif]>These are developed in Requirement phase
<![if !supportLists]>·       <![endif]>If the Use cases are really complicated Activity diagram are prepared. Example CRUD (creates, read, update and delete) operation use cases has no significance for making activity diagrams.
<![if !supportLists]>·       <![endif]>Activity diagrams will only be needed when you want some simplified look of a complicated use case.

<![if !supportLists]>·       <![endif]>Inputs - UseCase Diagram

<![if !supportLists]>-          <![endif]>Activity diagram’s map to a Use Case.

Design phase (Component diagrams à Class diagrams à Object diagrams à Collaboration diagrams à Sequence diagrams à State diagrams à Deployment diagrams)

Component Diagrams
<![if !supportLists]>·       <![endif]>In the Design phase the first document after the using the Use Case document should be the Component diagram.
<![if !supportLists]>·       <![endif]>Component diagrams form a high level classification of the system.
<![if !supportLists]>·       <![endif]>So after “Use Cases” just try to come out with a high level classification / grouping of related functionalities.
<![if !supportLists]>·       <![endif]>This should be compulsory diagram as outcome of this document will form “NAMESPACES” structure of .NET project.

Class Diagrams
<![if !supportLists]>·       <![endif]>Once the high level grouping is done you can go ahead with class diagrams.
<![if !supportLists]>·       <![endif]>From my point of view class diagrams should be compulsory in projects.

<![if !supportLists]>·       <![endif]>Inputs – UseCase Diagram

<![if !supportLists]>-          <![endif]>From the Use Case get the “NOUNS” which can form the class name and “VERBS” the method name.

<![if !supportLists]>-          <![endif]>For a Use Case there are multiple Scenarios.
<![if !supportLists]>-          <![endif]>From the collection of Scenarios (determined for a Use Case) identify Objects (NOUNS) & their Responsibilities (VERBS).
<![if !supportLists]>-          <![endif]>Then identify Relation among Objects.
<![if !supportLists]>-          <![endif]>Then you can draw Class Diagrams with Relationships.

Object Diagrams
<![if !supportLists]>·       <![endif]>Object diagrams are not compulsory it depends on how complicated your project.
<![if !supportLists]>·       <![endif]>Object diagrams show’s the relation between instances of class At Runtime.
<![if !supportLists]>·       <![endif]>In short it captures the state and relation of classes at any given moment of time.

Example you have class which creates objects of different classes, it’s like a factory.

<![if !supportLists]>·       <![endif]>In class diagram you will only show that it as a simple class with a method called as “CreateObject”.
<![if !supportLists]>·       <![endif]>But in object diagrams actually you will show the types of instances created from that object.

Collaboration Diagrams

<![if !supportLists]>·       <![endif]>Collaboration diagrams mainly depict interaction between object to depict a purpose.
<![if !supportLists]>·       <![endif]>These diagrams are more useful than Object diagrams as they are addressed for some purpose. Example “Login Process” which will use “Login object”, “User Object” etc to fulfill the login purpose.
<![if !supportLists]>·       <![endif]>Thumb rule - If there is activity diagram which shows some serious complicated scenarios I will like to go for this diagram for more simplified explanation.

State Diagrams
<![if !supportLists]>·       <![endif]>State chart diagram is again created if your project requires it.
<![if !supportLists]>·       <![endif]>If your project has some complicated start and end states to show then this diagram is most useful.
<![if !supportLists]>·       <![endif]>E.g. In a call center project where the agent phone pickup and hang state has to be depicted. So my first state was when agent picks up the phone and the final stage was when agent hangs the phone, the in between process was very complicated, which can only be shown by using state chart diagrams.

Sequence Diagrams
<![if !supportLists]>·       <![endif]>Sequence diagrams are needed if some sequence is complicated.
<![if !supportLists]>·       <![endif]>Inputs – UseCase Diagram

<![if !supportLists]>-          <![endif]>Sequence diagrams show Object interaction in sequence.
<![if !supportLists]>-          <![endif]>For a Use Case there are multiple Scenarios.
<![if !supportLists]>-          <![endif]>From the collection of Scenarios (determined for a Use Case) we identify Objects (NOUNS).
<![if !supportLists]>-          <![endif]>Now for the identified Objects, in a particular UseCase – Draw Sequence Diagram to show the interaction among those Objects.
<![if !supportLists]>-          <![endif]>The Sequence Diagram represents the interaction among the Objects on a time scale.

Deployment Diagrams
<![if !supportLists]>·       <![endif]>Deployment diagrams are again not a compulsory requirement.
<![if !supportLists]>·       <![endif]>It shows the hardware and software deployment of your system.
<![if !supportLists]>·       <![endif]>If you really have leisure in your project go for it or if you want to make the client smile seeing some diagrams.

Thanks & Regards,
Arun Manglick || Senior Tech Lead

No comments:

Post a Comment