I am following the textbook Object oriented software specification using UML, patterns and Java (3rd edition) and I am defining interfaces between system components (subsystems). But I encountered a practical problem in the notation.

Imagine for example a component Transaction Management component that deals with transactions and consumes an interface exported by a Database Storage component.

How should I name that interface ? Should I use a generic name like Storage and Database Service, or prefer a more specific to the consuming component like Transaction storage Management Service ?

  • 1
    What is the "object-oriented software specification" that you refer to? – Robert Harvey Aug 20 '18 at 17:10
  • The interface should be named according to its purpose. What is its purpose? – Robert Harvey Aug 20 '18 at 17:11
  • @RobertHarvey, it is a student book, "object oriented software engineering using UML and JAVA 3rd edition". The purpose of the interface is to serve as a link between the logic in the transaction component and the data stored in the database component. – Kaki Master Of Time Aug 20 '18 at 17:12
  • The purpose of the interface is to serve as a link -- Well, yes, but what is the nature of the link? Is it imparting customer information? Is it serving as a middleware bridge? What does the interface actually do? – Robert Harvey Aug 20 '18 at 17:16
  • Also, doesn't the book itself provide some guidance? Did it provide any examples of interface names? – Robert Harvey Aug 20 '18 at 17:17

In an UML component diagram, the interface represented by a connector should have a name that describes the service (behaviour) that the consumer needs, independently of the specific component that will provide it.

It is however not straightforward to answer your question, without knowing more about your intentions:

  1. If the providing components will all be database components (e.g. a MongoDB provider, an Oracle provider, a DB2 provider, etc..), the interface could very well be database storage interface.

  2. If the providing components could be something more general and be fulfilled by a database component, or a file storage component, or even a distributed network cache storage, then your interface name should be more genetric (eg. Storage interface)

  3. It is not forbidden to use a more specific name. In fact it is a common practice to draw a generic component in a diagramme and name the interface according to that providing/implementing component. This kind of convention is often used when the providing component in the diagram is supposed to be a placeholder and there is no intention to nale the different concrete variations of that component. But keep in mind that if the interface name is so specific that the providing components are no longer interchangeable, there would be something wrong.

But whatever the name you chose, it should be related to what is provided; not to what is consumed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.