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?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With