1

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?

  • Did you tried to implement it in the code? Did implementation fit your requirements? – Fabio Feb 12 at 21:59
  • I am trying using PHP, at this moments yes but using abstract classes instead interfaces – celsowm Feb 12 at 22:05
  • 2
    Seems reasonable to me. – Robert Harvey Feb 12 at 22:32
2

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.

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.