Visual-Basic-to-UML mapping

Mapping between Visual Basic elements and their
representation in UML2 model.
Visual Basic
Language
Features
Namespace
UML 2
Representation
UML2 representation details:
Package
A Namespace will be represented as UML Package.
Root
namespace
property of
Visual Basic
project
Module
Package &
Stereotype <<VB
Root
Namespace>>
Root namespace property of Visual Basic project can be
represented by applying <<VB Root Namespace>> stereotype
to UML package.
Class
&
Stereotype
<<VBModule>>
A Module will be represented as UML Class with <<VB Module>>
stereotype.
The members of Module will be specified in similar way as for
Class.
Interface
Interface
&
Stereotype
<<VBInterface>>
Class
&
Stereotype
<<VBClass>>
A Interface will be represented by UML Interface with <<VB
Interface>> stereotype for additional modifiers
Class
&
Stereotype
<<VBStructure>>
Class
&
Dependency
Relationship with
Stereotype
<<VBPartial>>
A Structure will be represented as UML Class and <<VB
Structure>> stereotype.
Class
Structure
Partial Types
A Class will be represented as UML Class and <<VB Class>> for
additional modifiers like Shadow, MustInherit etc.
In VB, only Class & Structure declaration can be Partial
declaration. A partial declaration specifies Partial modifier in the
declaration.
A Partial Class will be represented by combination of UML Class,
Dependency Relation and <<VB Partial>> stereotype.
Similarly Partial Structure will be represented by combination of
UML Class, <<VB Struct>>, Dependency Relation and <<VB
Partial >> stereotype.
Generic Types
Interface OR Class A generic type declaration specifies Type Argument list as (Of
TypeArgumenList) in declaration of Interface, Class and
Structure.
Generic Types will be represented as UML Class OR Interface with
Template Class Parameter applied.
Delegate
Class
&
Stereotype
<<VBDelegate>>
A delegate is a reference type that refers to a Shared method
of a type or to an instance method of an object. The closest
equivalent of a delegate in other languages is a function
pointer.
Delegate will be represented as UML Class with <<VB
Delegate>> stereotype applied and having a operation with same
name as Class to define delegate signature.
Enumeration
Function
Sub
Enumeration
&
Stereotype
<<VBEnum>>
Method
&
Stereotype
<<VBProcedure>>
Enumeration will be represented as UML Enumeration and <<VB
Enum>>.
Function procedure returns a value to calling code.
Function Procedure will be represented by UML Method with
Return type set and <<VB Procedure>> stereotype
Sub procedure does not return value to calling code.
Method
&
Function Procedure will be represented by UML Method and
Stereotype
<<VBProcedure>> <<VBProcedure>> stereotype
Extension
Methods
Partial
Methods
Declares
Constructor
Destructor
Operators
Property
Data
Members
Method
&
Stereotype
Property
<<VBProcedure>>
::Attributes =
“Extension()”
An extension method in VB 2008 can only be a Sub or Function
procedure. An extension method is marked by <Extension()>
attribute from System.Runtime.CompilerServices namespace.
Method
&
Stereotype
Property
<<VBProcedure>>
::Partial
Method
&
Stereotype
<<VBExternalProc
edure>>
Method
&
Stereotype
<<VBConstructor
>>
Method
&
Stereotype <<VB
Destructor>>
Method
&
Stereotype <<VB
Operator>>
Function Procedure will be represented by UML Method and
<<VB Procedure>> stereotype’s property Partial
Extension Method will be represented by UML Method with <<VB
Procedure>> stereotype’s Attributes set to “Extension()”.
Function Procedure will be represented by UML Method and
<<VB ExternalProcedure>> stereotype
Function Procedure will be represented by UML Method and
<<VB Constructor>> stereotype
Function Procedure will be represented by UML Method and
<<VB Destructor>> stereotype
Operators are methods that define the meaning of an
existing Visual Basic operator for the containing class.
Function Procedure will be represented by UML Method and
<<VB Operator>> stereotype. The UML method name should be :
Operator overloadableoperator
Method
&
Stereotype
<<VBProperty>>
Property will be represented by UML Method and <<VB
Property>> stereotype.
Attribute
&
Stereotype
Variable will be represented as UML Attribute and <<VB
Variable>>
<<VBVariable>>
Constant Type Attribute
&
Stereotype
Property
<<VBVariable>>::
Constant
Events
Method
&
Stereotype
<<VBEvent>>
Custom
Events
Attributes
Arrays
Method
Parameter
Method
&
Stereotype
Property
<<VBEvent>>::Cu
stom
Variable will be represented as UML Attribute and <<VB
Variable>> with Constant property set in stereotype.
Events are used to notify code of a particular occurrence. An
event declaration consists of an identifier, either a delegate type
or a parameter list, and an optional Implements clause.
Event will be represented as UML Attribute and <<VB Event>>
stereotype.
Custom events allows explicit declaration of AddHandler,
RemoveHandler and a RaiseEvent. None of the declarations
can have any modifiers, although they can have attributes.
Event will be represented as UML Attribute, <<VBEvent>>
stereotype and Custom property set in stereotype.
Property of
Stereotype
<<*>>::Attributes
Attribute will be represented as property of Visual Basic
stereotype for given element
Parameter/Prope
rty Stereotype
<<VB Array>>
Array types will be represented by <<VB Array>> stereotype.
Parameter and
Stereotype <<VB
Parameter>>
Parameters are specified as value, reference, optional, or
paramarray parameters by the modifiers ByVal, ByRef, Optional,
and ParamArray, respectively. A parameter that does not specify
ByRef or ByVal defaults to ByVal.
Method Parameter will be represented as UML method
parameter and <<VB Parameter>> stereotype for additional
modifier Optional & ParamArray.
Visual Basic Modifiers
Access Modifiers:
Modifier
Private
Protected
UML representation
Private Visibility
Protected Visibility
Public
Friend
Protected Friend
Parameter Modifiers:
Modifier
ByVal
ByRef
Optional
ParamArray
Public Visibility
Package property
Stereotype property
UML representation
IN Direction
IN OUT Direction
Property of <<VB Parameter>>
Property of <<VB Parameter>>
Procedure/Property Modifiers:
Modifier
UML representation
Overloads
Property of <<VB Procedure>>,
<< VB Operator>>, <<VB
External Procedure>> & <<VB
Property>> stereotypes
Overrides
Property of <<VB Procedure>> &
<<VB Property>> stereotypes
Overridable
-doNotOverridable
UML Leaf Qualifier
MustOverride
UML Abstract Qualifier
Other Modifiers:
Modifier
DataType (Enum)
Default (Property)
Shared
Shadows
UML representation
Property of <<VB Enum>> stereotype
Property of <<VB Property>>
stereotype
Static Qualifier
Property of
<<VB Class>>
<<VB Delegate>>
<<VB Enum>>
<<VB Event>>
<<VB ExternalProcedure>>
<<VB Interface>>
<<VB Operator>>
<<VB Procedure>>
<< VB Property>>
<<VB Structure>>
<<VB Variable>>
ReadOnly (Variable)
Inherits
Implements (Class)
Implements (Operation)
Lib
MustInherit
NotInheritable
Narrowing / Widening
New
Handles
Partial (Procedure)
With
WithEvents
UML ReadOnly Qualifier
Inheritance Relationship
Generalization Relationship
<<VB Implements>> stereotype applied
on a UML Dependency from Function
to Interface Function
Property of <<VB ExternalProcedure>>
stereotype
UML Abstract Qualifier
UML Leaf Qualifier
Conversions Property of <<VB
Operator>> stereotype
Property of <<VB Variable>> stereotype
As <<VB Handles>> stereotype applied
on a UML Dependency from Function
to Event.
The Variable property of the <<VB
Handles>> identifies the variable.
Property of <<VB Procedure>>
stereotype
Property of <<VB Variable>> stereotype
Property of <<VB Variable>> stereotype