Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UML class diagram: is this how to write abstract method and property?

When I was creating the first time an uml class diagram for a small C# project I had some trouble with the properties. At the end I just added the properties as a variable with <<property>> at the start. Now Im wondering how do I solve this with an abstract method? Should I just add <<abstract>> to the method an fine? Im doing something like this:

-----------------------------------
|           <<abstract>>          |
|             MyClass             |
-----------------------------------
|<<property>> + a : int           |
|<<property>> + b : string        |
-----------------------------------
|<<abstract>> # Job() : void      |
|<<abstract>> # Job2() : string   |
|- SomeNonAbstractMethod() : void |
-----------------------------------

Is this alright? Any suggestions?

like image 970
silla Avatar asked Sep 28 '12 08:09

silla


People also ask

Can UML diagrams show abstract classes?

The names of abstract classes and methods are italicized in UML: An interface can be viewed as an abstract class containing only abstract methods. In Java an interface may not contain fields, private members, or methods.

What are methods in UML class diagram?

Methods are small sections of code that work with the attributes. Figure below illustrates a class diagram for course offerings. Notice that the name is centered at the top of the class, usually in boldface type. The area directly below the name shows the attributes, and the bottom portion lists the methods.


1 Answers

Every "attribute" is actually a Property in UML2. Abstract methods are displayed by italic text (UML has a boolean value for this).

The notation you are using is called Keyword (simple way) or Stereotype (more complex). If you want to mark a Property as some kind of "special" that's fine with a keyword like you did.

like image 68
Christian Avatar answered Oct 12 '22 22:10

Christian