What's an "anOperation()" in this Factory Method diagram?

92 views Asked by At

I'm learning about the factory method pattern and its wikipedia page has the following diagram:

http://pl.wikipedia.org/wiki/Plik:Factory_Method_UML_class_diagram.svg

It's pretty simple so I understand everything except one thing - what is that mysterious anOperation() method? What does it do? More importantly - is it part of the pattern?

2

There are 2 answers

0
Fuhrmanator On BEST ANSWER

Tracking down the Wiki page that uses that figure, you'll find the Google translation from Japanese as follows:

Here, anOperation calls the factoryMethod, to obtain an instance of a subclass of the Product, be used.

I can't think of a real-world example of factory method that actually does this, however. The Java iterator() method in Collections is a factory method that does not use anOperation() as some intermediate step. I don't see anOperation as a fundamental part of that pattern.

2
evilcandybag On

It doesn't do anything. It is simply an example of the annotation used to represent methods in this type of diagram.