[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.mdt.uml2] Re: Question about extending classes with multiple stereotypes
|
Hi, Kenn,
Thanks for your response. It is good to know that the OMG is actively
looking at this, but also a little disconcerting to think that such a
user-friendly mechanism as profiles have been might disappear! Yes,
stereotypes are fully equivalent to MOF models, but I'm not sure that
the concept of ProfileApplication has any equivalent in metamodeling.
It's a very definite relationship indicating some reasonably
well-defined notions of domain-specific extension. Of course, if
"profile application" just takes another form, then that's another matter.
On the subject of the best practice for extensions: I understand the
practicality of defining extensions only on leaf stereotypes, but that
does raise problems, too:
- all leaf stereotypes in a hierarchy may end up with redundant
extensions of the same metaclasses
- how do I ask "is any stereotype conforming to Foo applied to my
element" using standard association navigation semantics in OCL?
- I don't necessarily know what is a leaf stereotype. Another
profile may well need to specialize my stereotypes
Perhaps the Classifier-ness of metaclass extensions can help address
some of these issues. Extensions (like other assocations) are
classifiers, and thus can be abstract. Let the super-stereotype in a
hierarchy define an abstract extension that specializing stereotypes can
specialize and redefine its ends, as necessary. They can narrow or
widen the redefined extension end's metaclass type for their own needs,
while letting clients of the more general stereotype still make
practical use of it.
I think we can marry some of these pragmatic best practices with
standard metamodeling practices. ;-)
In the mean-time, I think I shall also continue to mind an old
best-practice that we haven't mentioned, yet: don't make extensions
required! :-D Or, is that not still a best practice?
Cheers,
Christian
Kenn Hussey wrote:
Christian,
I agree that the autmatic application of required stereotypes is unnecessary
and inconsistent, at least from a purely structural perspective. Indeed, the
bounds on extension ends would ideally be evaluated only during validation,
and a case where a required stereotype has not been applied, valdation would
fail.
Unfortunately, much of the intended/expected semantics in UML aren't
strictly structural and are specified in a rather informal way;
incidentally, there is a working group at the OMG wrestling with this very
issue. The intended semantics of profile application (as an operation), in
cases where the profile contains required stereotypes, are such that all
required stereotypes are automatically applied. This is evidently
problematic in cases where there is a stereotype hierarchy involved, and
unsurprisingly is something that isn't explicitly addressed by the
specification. In the absence of formal guidance for cases like these, we
are left with best practices (which may eventually make their way into the
specification) as our guide. Based on the way the UML2 implementation works
(for better or worse), the "best practice" is to define extensions only on
non-abstract stereotypes and on leaf stereotypes in a hierarchy; using such
a practice offers the benefits of proeperty inheritence while at the same
time avoiding ambguous semantics.
Based on some of the discussions that have been taking place at the OMG, it
may well be the case that the notion of "profiles", at least in its current
incarnation, will go away (to be replaced by MOF modeling, which is
essentially what profiles, originally introduced as a "lightweight"
extension mechanism, have become in practice).
Kenn
-----8<-----