In my posting
When is a Property not a Property? I observed that coding language Properties and UML Properties are not the same thing.
I asserted that coding language Properties are just Operations masquerading as Attributes.
More precisely I meant to say:
coding language Properties are just UML Operations masquerading as UML Attributes.
Well, I wasn't exactly correct. You see, there are NO LONGER (as of the
[size=13]UML 2.1 Superstructure (interim)[/size] Specification and the
[size=13]UML 2.0 Superstructure (formal)[/size] Specification) UML Attributes - that is UML Elements whose name is Attribute (with a capital
A). UML 2 renamed Attribute to Property! There are attributes, but they are now Properties of Classes - specifically ownedAttribute..
Now, I (and obviously all the other readers of that posting) missed that until now - otherwise some one would have taken great glee in correcting me!
Within that thread, the posting:
Property Redux describes my views on modelling coding language properties and how I believe they could be modelled.
So it seems that what we previously called Attribute we now need to call Property.
Thus,
a coding language Property is now a UML Property with accessors.
What does this mean for UML modelling of such coding language Property constructs?It seems to me that in order to correctly round-trip such constructs the coding language Property must ostensibly appear to be an EA Attribute (thus an UML Property). Fortunately, EA seems to agree thus far. You can designate an EA Attribute as a coding language Property.
Secondly, the coding language Property must specify where it has read or write accessors. EA also concurs.
The visibility of the coding language Property defines that of the accessors. EA (incorrectly in my view) allows this to be variable. However proper modelling discipline will solve that.
The name of the accessors must be the same as the coding language Property (if exposed - such as with some forms of Basic). EA allows separate naming, discipline will help. By setting the Language type corectly you can get EA to force the accessor Operations to have this constraint for the language.
The coding language Property must allow the definition of the appropriate accessor bodies. EA supports this, however, from a modeling perspective, these accessors are normally one 'level below' the coding language Property. Fortunately, EA allow the suppression of Property methods via the Hide Property methods checkbox in the Diagram properties dialog. This allows only the coding language Property to be visible in the Class structural compartment.
Where a coding language Property actually interacts with one or more other UML Properties, it would be nice to be able to record this dependency. In particular, where a coding language Property is simply used to set and get another UML Property, one could have a checkbox so indicating that and a link to the bound UML Property. The accessor bodies could then be generated without further input.