views:

241

answers:

4

I'm drawing some UML in which a concrete class inherits from an abstract class which defines a pure virtual method. Is it required to show this method in the concrete class as well? It's implied by inheriting from the abstract class.

+3  A: 

Nope, you don't need to. in fact, in general, don't put any more in the UML than you must have to clarify what you're saying, unless you're (god forbid) trying to generate code from it.

The best guide I know of for UML is UML Distilled by Martin Fowler.

Charlie Martin
+1 for "god forbid". I take it that you're a "sketcher" of UML and not an MDA fan, Charlie. I agree with you. I think that UML's honeymoon as salvation of software has come and gone.
duffymo
I did a lot of my PhD work on "computer aided software engineering" and yeah, I'm not convinced of the utility of rigorous detail in UML.
Charlie Martin
If we had standardized on UML Distilled then UML might have had a better run.
Shane C. Mason
+1 "Clarify" is the key point. If it isn't clearer, it isn't helping. Details are what code is for.
S.Lott
Ok, that's good to know. Thanks.
Jack BeNimble
A: 

I just found this link, and it looks like you do :/

http://java-x.blogspot.com/2007/01/implementing-visitor-pattern-in-java.html

Jack BeNimble
Uhm, are you sure that you 'have to' jut because one guy who has a blog did?
Shane C. Mason
In explaining the pattern, it's useful. As a general statement, it adds complexity without adding information.
Charlie Martin
A: 

The funny thing about UML is that it has a pretty loose and varied definition. Most things that are called UML are actually not much more that block diagrams. There is a lot of ambiguity in any UML implementation.

I would say that if you are doing this for a presentation or architectural diagram, you can take care of a lot of the possible ambiguity with 'words'. If you will be generating code from it using some application, you should check the docs of that particular application.

Shane C. Mason
A: 

It's implied and in fact, many CASE tools would show you the inherited method as part of the list of the methods of the subclass when clicking on the class at looking at its properties (and some CASE tools even have the option of showing also the inherited methods in the diagram)

Jordi Cabot