Numa ARX
Numa ARX

Reputation: 21

Operations in UML diagram for a database

I was given an assignment to design a UML class diagram for the database of a courier service. But I am bit confused about operations that are added to the class diagram as getters and setters.

This is the diagram our lecturer gave, but there aren't given setters and getters for all of the attributes. Why do we need to add getters and setters for the uml diagrams of a database?

Upvotes: 2

Views: 165

Answers (1)

Christophe
Christophe

Reputation: 73406

In an UML diagram, you don't have to show everything: you may focus on elements that you want to highlight.

The getters and setters are not specific to uML, but are often added to provide controlled read/write access to properties that are private.

The fact that getters and setters are missing may be because:

  • the diagram author doesn't want to clutter the diagram and thinks that some examples are sufficient.
  • the property is used behind the scene in other operations.
  • the property is set by the constructor (which is not shown either).
  • any mix of the above-mentioned reason.

You could of course think that from a database perspective you just have to know about the properties. This would be a valid use of a class-diagram. However it would not be helpful for building applications that use that database. On modern architectures, the persistance in a database is more a question behind the scene in the design.

Upvotes: 1

Related Questions