Re: UML: Is it allowed to introduce custom stereotypes on classes? What about methods?



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
.



Relevant Pages

  • Re: UML Question (Object <-> ObjectFinder?)
    ... ER diagrams, Data flow diagrams, and ... The official notation for SM today is a subset ... It doesn't even use any stereotypes that aren't defined in UML. ... >> So long as the subclasses are substitutable, ...
    (comp.object)
  • Re: Humble opinion on UML
    ... I am not a real developer, but I use it sporadically since 1998 and I ... Even if one decides to employ OO techniques for a small application, it is even less likely that UML would be worthwhile for anything other that informal communication or sketching out design ideas. ... Activity Diagrams have been largely replaced by Abstract Action Languages because they are much easier to modify. ...
    (comp.object)
  • Re: Is UML appropriate for embedded systems ?
    ... Sequence diagrams are a good help in specifying ... The company I work for uses Rose for smartcard operating systems (a few ... The use of UML for our purpose is not obvious. ... usecases, but IMHO not for OSes or VMs ...
    (comp.arch.embedded)
  • Re: Class Design Tools?
    ... you draw diagrams of your code ... light understanding of UML class diagrams. ... I do not answer questions on behalf of my employer. ... >> programmer helping programmers. ...
    (microsoft.public.dotnet.general)
  • UML: Is it allowed to introduce custom stereotypes on classes? What about methods?
    ... 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 after the class name. ... I know UML knows such things as, but is it okay to shamelessly plug in your own stereotypes? ... 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 ...
    (comp.object)