Domanda

For teaching purposes, I'm trying to replicate in a more faithful way from this conceptual UML (from wikipedia):

conceptual abstract factory

In a "so-so" real world example, in my case, families of Loans and Insurances:

my abstract factory

So, can it be considered a valid GOF Abstract Factory?

Have I followed all the original principles? Or does it needs any kind of fix?

È stato utile?

Soluzione

Your diagram corresponds to an abstract factory according to the GoF.

In the original GoF, the diagrams did not use UML but a slightly modified version of Rumbaugh's OMT, which did not make difference between class inheritance and interface realization.

From an UML point of view, the dotted arrow already represents the interface realization. There is no need to add an «extend» keyword which in UML is meant for use-cases and means something different. Morevoer in java extends is used for class inheritance, which would add to the confusion in your diagram. Simply let this keyword out.

It's not necessary, but I'd show the keyword «use» for the dependency between the client and the abstract factory, and «create» for the products, because it helps the diagram to better understand the purpose. But this is a stylistic comment that you can ignore.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
scroll top