Operations in domain modeling class diagrams

In domain modeling class diagrams, an operation requests a service that a classifier or an instance of a class is called to perform. Operations are contained by classes and interfaces. A classifier can have any number of operations or none at all.

Operations are implementations of functions or queries that an object might be called to perform. A well-defined operation does only one thing.

For example, you can make a Cart class responsible for adding and removing merchandise that a client plans to buy. You can then add an addItem( ) operation that adds merchandise to the cart and a removeItem( ) operation that removes merchandise.

Operations are shown in the operation compartment of a classifier in a class diagram. Operations that are defined in the scope of the class, that is static, are shown as underlined. The visibility styles of operations can be represented as text symbols (such as "+") or icons (such as Image showing an Eclipse Protected visibility icon for operations.).

The following figure illustrates how operations are represented with visibility icons in class diagrams.

Java source code UML visual representation
The image shows the Java source code that appear as operations. The image shows how operations (methods) of Java classes are represented in UML class diagrams.

Feedback