On Mon, Aug 4, 2008 at 6:43 AM, Thilina Hasantha
<[EMAIL PROTECTED]> wrote:

> I got into a little problem while doing the "CSharp source import" module.
> Most of the parts are ok but importing class properties is the issue. As
> most of you know, unlike in java, C# has a concept called properties. These
> can have getters and setters. We cannot model a property in the same way we
> do for an attribute in java.  If the property has only the getter, we have
> to indicate its state somehow.

In addition to having enough information to roundtrip, the other
important criteria is being able to interchange the UML model with
other tools and have it be understood and have the same semantics.

Are there any standards in the C# community for how to do this modeling?

In a brief search I found:

Microsoft Visio 2003 http://office.microsoft.com/en-us/visio/HP815507911033.aspx
IBM/Rational 
http://www.ibm.com/developerworks/rational/library/07/1113_rajendra/
    
http://publib.boulder.ibm.com/infocenter/rsmhelp/v7r0m0/index.jsp?topic=/com.ibm.xtools.transform.uml2.cs.doc/topics/t_cs_over.html

but nothing that looked like it was a definitive industry standard.
The OMG doesn't appear to have done any work in this space.

> We can use stereotypes as a solution. So I'm suggesting the following,
>
> <CSharp property (read only)>  when property has only getter
>
> <CSharp property (write only)>  when property has only setter
>
> <CSharp property (read write)>  when property has both getter and setter

Stereotypes are a good solution, but a more natural way to encode the
getter/setter would be to use Tag Definitions owned by the Stereotype.
 If you wanted to follow the Rational model, this would be something
like <<CSharp Property>> with a tagged value called "accessors" that
took values of "read-and-write", "read-only", and "write-only".  Then
as you added additional things that need to be encoded, you could add
new Tag Definitions like "abstract".  ArgoUML filters all the
TagDefinitions by applied stereotype, so when the user goes to create
a TaggedValue, they'll be guided to use the ones that are appropriate
for the given stereotype.

One shortcoming in ArgoUML support that will affect how you design
this is datatypes supported for TagDefinitions/TaggedValues.  ArgoUML
hasn't been enhanced in this area since UML 1.3 days, so it only
supports String values.  Ideally you'd like the "accessors" to be
typed as an Enumeration so that the user can just pick a valid value
from a list, but for the time being they'll need to deal with free
form text.  Of course this isn't an issue for the reverse engineering
module since it'll be creating the TaggedValues programmatically.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to