附录一:翻译英文部分
本文引自网站http://www.ibm.com
Modeling C# applications using Rational Modeling Extension for .NET
ABSTRACT
Learn how to model Microsoft.NET C# applications by using IBM Rational Modeling Extension for .NET, which is available in IBM Rational Software Modeler, Rational Systems Developer, and Rational Software Architect. This article describes how to model various C# constructs, and the author assumes that you are familiar with basic UML modeling concepts and using Rational modeling tools.
IBM Rational Modeling Extension for Microsoft.NET enables .NET application developers to use Rational modeling tools in designing applications.This extension is available in IBM Rational Software Modeler, IBM Rational Systems Developer, and IBM Rational Software Architect, and it includes support for modeling C# applications.
Key Words: Structure;Extentsion;Modeling;
Text
If you have knew about modeling simple C# applications by using the C# profile and type library provided by Rational Modeling Extension for Microsoft.NET. Therefore, you should now be familiar with modeling C# classes, structures, interfaces, delegates, enumerations, fields, and methods. This article like to use the same example of the graphics library project used as common to help you understand how to model other C# concepts, such as indexers, properties, operators, and others.
This part builds on the previous article by describing how to use this extension to model these constructs:
· Constructors and destructors ;
· Operators ;
· Properties ;
· Indexers;
· Events ;
· Attributes;
· Namespace ;
This article also explains how to validate your model for C# applications.
Part 1. Modeling constructors and destructors
Like C# methods, a constructor or destructor is also modeled as a UML operation with optional an <<CSharp Method>> stereotype for specific modifiers (for example, extern). A UML operation representing a constructor is given the same name as its parent class or structure name. A destructor is named in a similar manner, except that it has a ~ (tilde) followed by the model’s name.
A return type should not be set for a UML operation representing either a constructor or a destructor. Parameters are added to the constructor similarly to how you add parameters to method. A static constructor is modeled by setting the static property of the corresponding UML operation.
Figure 1 shows a constructor with two arguments of type Point and a destructor modeled for the DrawingSurface class of the sample application used here for illustration purposes.
Figure 1. C# constructor DrawingSurface(Point start,Point end) and destructor DrawingSurface().
Part 2.Modeling operators
C# operators are modeled as UML operation with optional <<CSharp Method>> stereotype for specific modifiers, such as extern. A unary operator is named by using the key word operator followed by the unary operator symbol. For example, the unary increment operator is named as operator ++. A return type and a single parameter are set for UML operation that represents a unary operator.
A UML operation representing a binary operator is named similarly to unary operator, but the symbol is one of the binary operators. Also, two parameters are set, and the return type is specified for a UML operation corresponding to a C# binary operator. For example, a C# operator of == (two equal signs) is named operator == in the UML model. The conversion operators in C# are represented by UML operations named as either implicit operator or
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] ... 下一页 >>