Nothing Special   »   [go: up one dir, main page]

Staruml-System Modelling Using Staruml

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

STARUML-

SYSTEM
MODELLING
USING STARUML
Introduction
ABSTRACT
This is an introduction to the STARUML tool. This
document gives a brief guideline on using STARUML
tool to develop UML based system models
Anupama KR & Meetha.V.Shenoy
Embedded System Design

System Design using StarUML
UML is a standard language for specifying, visualizing, constructing, and documenting the artifacts of
software systems.UML was created by Object Management Group and UML 1.0 specification draft
was proposed to the OMG in January 1997.This document gives a brief understanding on using
STARUML.
1. Introduction to StarUML
1.1. Key Features:
StarUML is a software modeling platform that supports UML (Unified Modeling Language). It is
based on UML version 1.4 and provides eleven different types of diagram, and it accepts UML 2.0
notation. It supports the MDA (Model Driven Architecture) approach and provides the UML Profile
concept, allowing creation of platform independent models.
StarUML provides Software model verification support .The software provides features to verify the
software model developed by the user, facilitating early discovery of errors, and allowing more
faultless and complete software development
StarUML provides excellent extensibility and flexibility. It provides Add-In frameworks for
extending the functionality of the tool. All functions of the StarUML tools are automated according to
Microsoft COM. Any language which supports COM (Visual Basic Script, Java Script, VB, Delphi,
C++, C#, VB.NET, Python, etc.) can be used to control StarUML or develop integrated Add-In
elements.
StarUML facilitates generation of stub source codes from UML Models , converts source codes into
programming languages , imports Rational Rose files, exchanges modeling information with other
tools using XMI, and supports design patterns. These Add-Ins offer additional reusability,
productivity, flexibility and interoperability for the modeling information.
The StarUML provides support for drawing the 11 UML Diagrams ie , Usecase diagrams, Class
Diagrams, Sequence Diagrams, Sequence Diagrams (Role) , Collaboration Diagrams ,Collaboration
diagrams (Role) , Statechart diagram ,Activity diagram ,Component diagram ,Deployment diagram
and Composite structure diagram
1.2 Basic Concepts
StarUML makes a clear conceptual distinction between models, views and diagrams. A Model is an
element that contains information for a software model. A View is a visual expression of the
information contained in a model, and a Diagram is a collection of view elements that represent the
users specific design thoughts.
A project is the basic management unit in StarUML. A project can manage one or more software
models. It is the top-level package that always exists in any software model. In general, one project is
saved in one file.
Project Structure: A project contains and manages the following sub-elements.
Model Element that manages one software model.
Subsystem Element that manages models that express one subsystem.
Package The most general element for managing elements.

Project files are saved in the XML format with the extension name .UML. All models, views and
diagrams created in StarUML are saved in one project file. A project may also be divided up and
saved in multiple units. A project file contains the following information.
UML profiles used in the project
Unit files referenced by the project
Information for all models contained in the project
Information for all diagrams and views contained in the project
Notes:
1.2.1 Working with UML PROFILE
Predefined UML profiles can be included for use with the current project. Once a UML profile is
included in a project, the stereotypes, tag definitions and data types defined in the profile can be
used in the project.
Procedure for Including UML Profile:
1. Select the [Model] -> [Profiles] menu.
2. At the Profile Manager window, select a profile from the available profile list on the left, click
the [Include] button and then click the [Close] button.

3. The selected profile is included in the current project.
The profile list in the Profile Manager may vary according to the users installation environment.

Procedure for Excluding UML PROFILE
The UML profiles included in the current project can be excluded. Once a UML profile is excluded
from a project, the stereotypes, tag definitions and data types defined in the profile cannot be
used in the project.
Procedure for Excluding UML Profile:
1. Select the [Model] -> [Profiles] menu.
2. At the Profile Manager window, select a profile from the included profile list on the right,
click the [Exclude] button and then click the [Close] button.
3. The selected profile is excluded from the current project.
1.2.2 Units:
While a project is generally saved in one file, there are cases where one project needs to be saved in
many smaller files so that a number of developers can work on the project together. In this case, the
project can be managed as multiple units. A unit can have a hierarchical structure; it may contain
many sub-units under it. Units are saved as .UML files and are referenced by project files (.UML) or
other unit files (.UNT).
Unit Composition : Only package, subsystem and model elements can constitute one unit. All
elements under these package type elements are saved in the respective unit file (.UNT).
Unit Hierarchical Structure : Just as a project can manage many units under it, a unit also can
manage many sub-units. Since a parent unit has reference to its child units, all units have a
hierarchical structure.
2. Managing a Project
2.1 Creating New Project
In order to work on a new software development, a new project must be created. You may start
with a completely empty project or with a new project that has been initialized according to a
specific approach.
Procedure for Creating New Project:
1. Select the [File] -> [New Project by approach] menu.
2. A window pops up as shown in figure

If in the pop up window Set as Default Approach is selected then the next time a New
project is created then the approach, profiles and/or frameworks may be automatically
loaded included/loaded
3. Select the desired approach and click on OK.
Brief introduction to various approaches in STARUML :
4+1 Approach:
Philippe Kruchten originally presented the 4+1 View Model to describe the architecture of
software-intensive systems based on the use of multiple, concurrent views. The views are
used to describe the system from the viewpoint of different stakeholders, such as end-users,
developers and project managers. The four views of the model are logical, development,
process and physical view. In addition selected use cases or scenarios are utilized to illustrate
the architecture serving as the 'plus one' view. Hence the model contains 4+1 views

Logical view: The logical view is concerned with the functionality that the system provides
to end-users. UML Diagrams used to represent the logical view include Class diagram,
Communication diagram, and Sequence diagram.
Development view (Implementation view): The development view illustrates a system from
a programmer's perspective and is concerned with software management. It uses the UML
Component diagram to describe system components. UML Diagrams used to represent the
development view include the Package diagram.
Process view : The process view deals with the dynamic aspects of the system, explains the
system processes and how they communicate, and focuses on the runtime behavior of the
system. The process view addresses concurrency, distribution, integrators, performance, and
scalability, etc. UML Diagrams to represent process view include the Activity diagram.
Physical view : The physical view depicts the system from a system engineer's point-of-view.
It is concerned with the topology of software components on the physical layer, as well as the
physical connections between these components. This view is also known as the deployment
view. UML Diagrams used to represent physical view include the Deployment diagram
Scenarios(Use case view) : The description of an architecture is illustrated using a small set
of use cases, or scenarios which become a fifth view. The scenarios describe sequences of
interactions between objects, and between processes. They are used to identify architectural
elements and to illustrate and validate the architecture design. They also serve as a starting
point for tests of an architecture prototype. This view is also known as use case view.
Rational Approach supports 4 different views ie, Use case, Logical, Component and
Deployment views
UML Components approach is used for component based development cycles.
2.2 Procedure for Saving Project:
1. Select the [File] -> [Save] menu.
2. If the project file name has not been specified, the Save Project dialog box appears.
Enter the file name and click the [Save] button.

3. UML DIAGRAMS
3.1. Modeling with Use Case Diagram
To draw a use case diagram, double-click the Scenarios View (If 4+1 view is chosen or click on
use case model/view for default or Rational approach). You can start drawing use cases in the
default Main diagram or you can add a new diagram by right-clicking the Use Case View and
then choose [Add Diagram] [Use Case Diagram]

The diagram notations can bee seen from the Toolbox on the left pane (shown below ). Note that the
content of the Toolbox changes depending on which diagram type you are currently working on.


To draw a diagram element (e.g., a use case), you need to click the diagram element in the Use
Case pane (in Toolbox) and click in a desired position in the canvas. Note that you can browse or
modify the properties of a diagram element via the Property pane underneath the Model/Diagram
Explorer.
The following elements are available in a use case diagram.
Actor
UseCase
Association
Directed Association
Generalization
Dependency
Include
Extend
System Boundary
Package

Actor: An actor defines a coherent set of roles that users of an entity can play when interacting with
the entity. An actor may be considered to play a separate role with regard to each use case with which
it communicates.
Procedure for creating Actor
In order to create Actor, click [Toolbox] -> [UseCase] -> [Actor] button and click the position
where to place Actor. Actor is shown in the form of stick man or rectangle with icon, that is
decoration view. To display actor in decoration view, select [Format] -> [Stereotype Display] -
> [Decoration] menu item

Note: A third display format (Iconic ) is also available in StarUML
System Boundary: A System Boundary is a type of partition that represents the boundary between
the thing you are representing with the use cases (inside the boundary) and the actors (outside the
boundary). Its most typical usage is the boundary of an entire system. Use cases can be used to
represent subsystems and classes and so the boundary may be more specific than an entire system. A
package with a stereotype top-level can be used as a boundary and name space within the use case
model to denote the same thing as the use case boundary.
In order to create system boundary, click [Toolbox] -> [Use Case] -> [System Boundary] button, drag
from the starting point of system boundary and drag to right-bottom point of system boundary.

Use Case: The use case construct is used to define the behavior of a system or other semantic entity
without revealing the entitys internal structure. Each use case specifies a sequence of actions,
including variants that the entity can perform, interacting with actors of the entity.
Procedure for creating Use Case
If you have selected the 4+1 Approach, the use case diagram can be drawn under the scenarios
view.
In order to create usecase Go to Model explorer window.Select scenarios Add diagram, select
Use case diagram[In case you chose the Rational rose or Default approach you can see the use
case model/view in the model explorer .Select use case view Add usecase diagram

Select the use case element from the toolbox window. Drag the element to the canvass.


Use case Relationships
1. Association /Directed Association
In order to create association, click [Toolbox] -> [UseCase] -> [Association] button, drag
from first element, and drop to second element in the [main window].
To create directed association , click [Toolbox] -> [UseCase] -> [Directed Association]
button, drag from first element, and drop to second element in the [main window]
2. Generalization
Generalization is the taxonomic relationship between a more general element (the parent) and
a more specific element (the child) that is fully consistent with the first element and that adds
additional information.
In order to make generalization, click [Toolbox] -> [UseCase] -Generalization] button,
drag from child element and drop to parent element in the [main window].
3. Dependency
A dependency is a type of relationship that signifies that one element, or group of elements,
acting as the client depends on another element or group of elements that act as a supplier. It
is a weak relationship that denotes that if the supplier is changed the client may be affected. It
is a unidirectional relationship. In order to create dependency, click [Toolbox] -> [UseCase] ->
[Dependency] button, drag element and drop to other element depended.
4. Include
An include relationship defines that a use case contains the behavior defined in another use
case.
In order to create include relationship, click [Toolbox] -> [UseCase] -> [Include] button,
drag from element including and drop to element included in the [main window].

5. Extend
An extend relationship defines that instances of a use case may be augmented with some
additional behavior defined in an extending use case.
In order to create extend, click [Toolbox] -> [UseCase] -> [Extend] button, drag from element
extending and drop to element extended in the [main window].

Example: Use case diagram for the Micro wave oven (Discussed in module 2) can be drawn as
follows.


Note: Once a model diagram is drawn you can export the diagram as a .jpg or .bmp image(File
Export diagram)
3.2 Modeling with Class Diagram
Class diagram can be included under the logical view(if 4+1approach is selected)
The following elements are available in the class diagram.
Subsystem
Package
Class
Interface
Enumeration
Signal
Exception
Port
Part
Association
Directed Association
Aggregation
Composition
Generalization
Dependency
Realization
Association Class
Connector
Object
Link
Subsystem:Whereas a package is a generic mechanism for organizing model elements, a
subsystem represents a behavioral unit in the physical system, and hence in the model.
1. Click [Toolbox] -> [Class] -> [Subsystem] button.
2. And click at the location or boundary where subsystem will be placed in the [main
window].
3. Then a subsystem is created on the class diagram and subsystem quick dialog is opened. At
the quick dialog, enter the subsystem name.
You can also create interfaces for the subsystem
Class: A class is the descriptor for a set of objects with similar structure, behavior, and
relationships.
Procedure for creating class
In order to create class,
1. Click [Toolbox] -> [Class] -> [Class] button.
2. Click at the position where class will be placed in the [main window].
3. A new class is created on the diagram and class quick dialog is opened.
4. At the quick dialog, enter the class name and press [Enter] key.

Procedure for adding attribute
There are three methods through which an attribute can be added to class.
using quick dialog
using model in the [main window] or the [model explorer]
using [collection editor]
In the case of using quick dialog,
1. Double-click class.
2. Press [Add Attribute] button at the quick dialog, and you can add attribute.


In the case of using model,
1. Select class in the [main window] or in the [model explorer].
2. Right-click the selected class, select [Add] -> [Attribute] popup menu


In the last case,
1. Select [Collection Editor...] popup menu.
2. Or click button in [attributes] property on properties window.
3. At [attribute] tab of the [collection editor], you can add attribute by using button.


Procedure for adding operation
There are three method to add attribute to class.
using quick dialog
using model in the [main window] or the [model explorer]
using [collection editor]
Procedure for adding operation
There are three method to add attribute to class.
using quick dialog
using model in the [main window] or the [model explorer]
using [collection editor]

In the case of using quick dialog,
1. Double-click class and class quick dialog is shown.
2. Press [Add Operation] button at the quick dialog, and you can add operation.

Or, select class in the [main window] or in the [model explorer], right-click the selected
class, select [Add] -> [Operation] popup menu


Using the collection editor also you can add operations
Once the attribute or operation is created you can also set the visibity by double clicking on
the attribute/operation .You can chose the visibility from the options as shown in the image
below

Procedure for creating port
In order to create port,
1. Click [Toolbox] -> [Class] -> [Port] button.

2. And click the class where the port will be contained in the [main window].

Exception :An exception is a signal raised by behavioral features typically in case of execution
faults. An Exception is associated with the Behavioral Features that raise it.
Procedure for creating exception
In order to create exception,
1. Click [Toolbox] -> [Class] -> [Exception] button.
2. And click at the position where exception will be placed in the [main window].

Object: An object represents a particular instance of a class. It has identity and attributes values.
A similar notation also represents a role within collaboration because roles have instance-like
characteristics.
Procedure for creating object
In order to create object,
1. Click [Toolbox] -> [Class] -> [Object] button.
2. And click at the position where object will be placed in the [main window].
Procedure for adding Attribute Link to object
There are two way to add Attribute Link to Object.
using object model in the [main window] or the [model explorer]
using [collection editor]

In the case of using object model, select object in the [main window] or in the [model explorer],
right-click the selected object, select [Add] -> [Attribute Link] popup menu, and you can add
Attribute Link.
In the other case, select [Collection Editor...] ,right click on the class ,choose collection edior and
add attribute as shown in the diagram below

The relationships between the various class diagram elements can be established as we have done
in case of use case diagram
Example : One of the possible class diagram representation for the microwave oven discussed in
Module 2(Note that You should add attributes also to the class diagram )
Some examples are : For Push button ,attribute can be Bool ,since the possible state of a push
button is either on or off .For Oven control ,some of the possible attributes are Bool ,for on/off
controls or integer for configure mode etc)(Note that the diagram is not complete )


3.3 Modeling with Sequence Diagram
The following elements are available in a sequence diagram.
Object
Stimulus
SelfStimulus
Combined Fragment
Interaction Operand
FrameSubsytem

Object
Procedure for creating object
In order to create object,
1. Click [Toolbox] -> [Sequence] -> [Object] button.
2. And click at the position where object will be placed in the [main window].
3. Object quick dialog is shown. At the quick dialog, enter the object name.
4. Press [Enter] key.

Procedure for creating class from object
If class is not assigned to object,
1. Double-click object to pop up quick dialog, click add class button
2. At the [Enter element name] dialog, enter the new class name.
3. And new class is created and assigned to object.


Stimulus: A Stimulus is a communication between two Instances that conveys information with the
expectation that action will ensue. A Stimulus will cause an Operation to be invoked, raise a
Signal, or cause an Instance to be created or destroyed.
Procedure for creating stimulus
In order to create stimulus,
1. Click [Toolbox] -> [Sequence] -> [Stimulus] button.
2. Drag from one object, and drop to the other(object or lifeline) in the [main window] in
outgoing direction.
3. Stimulus quick dialog is opened. Enter the stimulus name at the quick dialog and press
[Enter] key.

Procedure for using operation in class as stimulus
If classifier property of receiver (object) of stimulus is assigned and you want to assign operation
to stimulus,
1. Double-click stimulus
2. Click button at the quick dialog.
3. Select operation on the [Select an operation] dialog, and click [OK] button.

New stimulus mapped to class's operation is added as follows.



Procedure for creating operation of class from object
To create operation of class as stimulus's receiver from object and assign it to stimulus,
1. Double-click stimulus, click button at the quick dialog.
2. Enter new operation name to be created, and click [OK] button.


New operation is added to the class and text is filled at the quick dialog (This procedure is valid
when there exists assigned class.). Press [Enter] key.




Check the model explorer window to confirm creation of new operation.
Procedure for changing ActionKind of stimulus
The [ActionKind] property of stimulus should be assigned to one of five sort as following. To
change [ActionKind] property, select stimulus and select the [ActionKind] property on the
properties window.

Action kind Shape
CALL

SEND

RETURN

CREATE

DESTROY


Procedure for creating self-stimulus
In order to create self-stimulus,
1. Click [Toolbox] -> [Sequence] -> [SelfStimulus] button.
2. And click the object(or lifeline) that self-stimulus will be placed in the [main window].
3. Object quick dialog is opened. At the quick dialog, enter the stimulus name and press
[Enter] key.
4. The result of procedure is as follows. You may arrange stimulus position to reduce
overlapping of text and line.



Example : Sequence diagram for the Microwave oven discussed in Module 2 .Only the action
sequence following an autocook option is implemented here (The sequence diagram is not
complete)

3.4Modelling with Activity diagram
The following elements are available in a activity diagram.
ActionState
SubactivityState
InitialState
FinalState
Synchronization
Decision
Flow Final
Object Flow
Signal Accept State
Signal Send State
Transition
SelfTransition
Swimlane
Action state: An action state represents the execution of an atomic action, typically the
invocation of an operation. An action state is a simple state with an entry action whose only exit
transition is triggered by the implicit event of completing the execution of the entry action. The
state therefore corresponds to the execution of the entry action itself and the outgoing
transition is activated as soon as the action has completed its execution.
Procedure for creating state
In order to create State,
1.Click [Toolbox] -> [Statechart] -> [State] button.

2. And click at the position where State will be placed in the [main window].

3. A state is created and quick dialog appears. Enter the state name at the quick dialog .

4.And press [Enter] key to have done this procedure.

In similar way you can utilize the Initial state and Final state elements
Procedure for creating decision
In order to create Decision,
1. Click [Toolbox] -> [Activity] -> [Decision] button.
2. And click at the position where Decision will be placed in the [main window]. The decision
is created on the diagram.

Procedure for creating decision from state
In order to create decision with incoming transition from selected object, use shortcut creation
syntax.
1. Double-click state. At the quick dialog, enter "-><>"("<-<>" for incoming from decision)
string.
2. Press [Enter] key and decision with outgoing transition from selected state is created.

Procedure for creating flow final
In order to create Flow Final,
1. Click [Toolbox] -> [Activity] -> [Flow Final] button.
2. And click at the position where Flow Final will be placed in the [main window].

Procedure for creating synchronization bar
In order to create Synchronization,
1. Click [Toolbox] -> [Activity] -> [Synchronization] button.
2. And click at the position where Synchronization will be placed in the [main window] and
drag as size as you want.
3. The following figure shows the result of this procedure.

Procedure for creating transition
In order to create Transition,
1. Click [Toolbox] -> [Activity] -> [Transition] button.
2. Drag and drop between states in transition direction in the [main window].
3. Then the transition is created.

Example: Activity diagram for the microwave oven discussed in Module 2

4. Model Verification
To verify the model you have developed go to Model Verify Model Verify
5. Generating Stub code
To generate the stub code , Go to Tools C++ Generate code .[You can generate C++ ,C or Java
code ].
Before generating code make sure that the appropriate Language profile is selected.
For example , to generate a C++ code ,
Go to Model Profiles -> Add C++ Profile

6. Managing Units
Although a project can be managed as one file, it may be convenient to divide it into many
units and manage them separately if many developers are working on it together. This section
describes procedures for creating and managing units.
Creating unit
Merging unit
Saving unit
Removing unit
It may be necessary to save a part of a project or unit as a separate unit. For instance, when
many developers are working on the project together, the project can be divided into many
units and managed by tools like Microsoft Visual SourceSafe or CVS. Only Package, Model
and Subsystem elements can be saved as units.
Procedure for Creating New Unit:
1. Select an element (package, model or subsystem) to make into a unit.
2. Right-click and select the [Unit] -> [Separate Unit] menu.
3. At the Save dialog box, enter the unit file name and click the [Save] button.
4. The selected element is saved as a unit.

MERGING UNIT
If the elements in a unit no longer need to be managed as a separate unit, the unit file can be
merged with the project.
Procedure for Merging Unit:
1. Select from the model explorer an element (project, model, package or subsystem) that will
contain the unit to import.
2. Right-click and select the [Unit] -> [Uncontrol Unit] menu.
3. The unit is merged with the selected project or parent unit.

SAVING UNIT
If changes are made to a unit, they needs to be saved properly. The changes can be saved over
the existing unit file or saved as another unit file.
Procedure for Saving Unit:
1. Select the unit to save from the model explorer.
2. Right-click and select the [Unit] -> [Save Unit] menu.
3. The unit file is saved.

Procedure for Saving Unit as Another File:
1. Select the unit to save from the model explorer.
2. Right-click and select the [Unit] -> [Save Unit As] menu.
3. At the Save Unit As dialog box, enter the new unit file name and click the [Save] button.
4. The new unit file is saved.

REMOVING UNIT
If a unit is no longer required in a project, the unit can be removed. Removing a unit deletes all
the elements contained in it and the unit is no longer loaded in the project automatically. Please
take note that you should use Merge Unit instead of Remove Unit if you intend to merge a unit
with a project and no longer manage it as a separate unit.
Procedure for Removing Unit:
1. To remove a unit, select from the model explorer the element (package, model or
subsystem) that contains the unit.
2. Right-click and select the [Unit] -> [Delete Unit] menu.
3. A dialog box appears confirming whether you want to remove the unit. Click [Yes].
4. The unit is completely removed from the project.


More information regarding STARUML Can be obtained from the Help option available
with the software.

You might also like