Re: UML: Is it allowed to introduce custom stereotypes on classes? What about methods?
- From: Robert C. Martin <unclebob@xxxxxxxxxxxxxxxx>
- Date: Wed, 25 May 2005 14:01:36 -0500
On Wed, 25 May 2005 07:42:56 +0200, Matthias Kaeppler
<nospam@xxxxxxxxxxxxxxx> wrote:
>Hello again,
>
>we had the problem to model a Java 5 enumeration in a class diagram in
>UML, and our approach was to just model it as a usual class and put a
>{enumeration} after the class name.
>Is that okay? I know UML knows such things as {abstract}, but is it okay
>to shamelessly plug in your own stereotypes?
Yes, it's OK. You could use the stereotype <<enum>> for example.
The question is, *why* would you do that? Creating models with so
much detail that they capture things like enums is pretty inefficient.
You are probably driving your models into far too much detail.
>We also did this with methods:
>Since we use a very limited modelling tool, which had no means of
>modelling methods as abstract or even static, we e.g. modelled a static
>method like this:
>
>+ foo() : void {static}
>
>Is that okay?
The thing to ask yourself is whether or not the team who must
understand these diagrams, understands the diagrams. When I look at
what you've done, I understand it immediately.
Again, however, it seems to me that capturing static methods may be
too much detail. Why do you need to drive your models to a level of
detail that is better expressed as code.
Remember, models are *purposely* incomplete. It should not be the
goal to generate 100% of your code from your models. Indeed, I don't
think generating code from UML makes a lot of sense in most
circumstances. Code is much easier to write than correspondingly
detailed UML diagrams. Consider, for example, how much easier it is
to write: enum Color {red, green, blue}; Than it is to draw the
corresponding UML diagram complete with Stereotypes and inheritance
relationships.
-----
Robert C. Martin (Uncle Bob) | email: unclebob@xxxxxxxxxxxxxxxx
Object Mentor Inc. | blog: www.butunclebob.com
The Agile Transition Experts | web: www.objectmentor.com
800-338-6716
"The aim of science is not to open the door to infinite wisdom,
but to set a limit to infinite error."
-- Bertolt Brecht, Life of Galileo
.
- References:
- UML: Is it allowed to introduce custom stereotypes on classes? What about methods?
- From: Matthias Kaeppler
- UML: Is it allowed to introduce custom stereotypes on classes? What about methods?
- Prev by Date: Re: Dated info: Mentor acquires Project Technology
- Next by Date: Re: Will the UML ever become truly universal?
- Previous by thread: Re: UML: Is it allowed to introduce custom stereotypes on classes? What about methods?
- Next by thread: Will the UML ever become truly universal?
- Index(es):
Relevant Pages
|