There's quite a bit to say about the diagram so I will give you bits at a time, otherwise replies will be very long.
1. Naming - WriteToStringInterface
are not good names. They're also not idiomatic names for interfaces. Those are verb phrases and as such are better suited as method names that evoke a sense of action. Class and interface names should be noun phrases or adjectives. Writable and Indentifiable are adjectives that I would expect to be names of interfaces because they end with "-able". Another example is the Comparable
interface in the standard Java Collections Framework.
2. Archetype - you use <<Java Class>> for Company but since it has a getInstance
method, this is probably better: <<Singleton>>
3. Archetype - you use <<Java Class>> for Identifiable. That will probably be better as an interface as its name suggests. This is a poor candidate for a base class and can quickly lead you to a very problematic design if you use it as a base class and extend it with subclasses that wouldn't be related otherwise, thus creating a poor inheritance structure. A couple of rules of thumb to remember: Favor composition over inheritance
and Design and Document for inheritance
. These two are not contradictory, as a cursory glance might make you think. Follow the first one (composition over inheritance) but if you must
use inheritance, then make sure you consider it carefully and design around it properly.