Reputation: 134
I have a homework that requires me to create a UML diagram for an actual Java program. But there are several constructors methods in the program and I'm confused. Should I add these constructors methods to the diagram or not?
Upvotes: 3
Views: 6393
Reputation: 6328
As per UML specification (section 11.4.4 of version 2.5):
A constructor is an Operation having a single return result parameter of the type of the owning Class, and marked with the standard stereotype «Create».
If you're creating a diagram to document a code you should include all explicit constructors.
If you're building a model focusing on functionality constructors are typically omitted. But then your level of details is entirely different.
Upvotes: 6