The visitor pattern can be used on structures of objects which implements a specific interface defining a method called accept. In practice, in many cases, the structures are already created and we have to visit structures of already created objects. Changing hierarchies of classes for adding a new method is not a viable solution.
We need somehow to extend the structure of objects for accepting the visitors without changing them. A way of doing it would be to add a wrapper for the hierarchy classes which accepts visitors and duplicates the structure.
A marker interface is a design pattern consisting in an interface with no methods declared. All the classes implementing this interface don’t have to implement a method for the interface(since it doesn’t have an interface), but we can say that the classes implementing the interfaces are marked. For example in Java we have the Serializable interface. It is a Marker Interface, when we create a class in order to mark it as a serializable class, it will implement the serializable, so everyone using it will know that the class is serializable.
What is Factory Pattern?
Factory Pattern is a creational design pattern. It is responsible for creating instances of objects without using directly the object constructor. For this reason Factory Pattern is widely used in frameworks, to encapsulate the logic of creating the objects and to make the framework independent of the objects it needs to work with.
There are several types of factories, depending of the implementation:
You can find more information about Factory Design Pattern and the other Design Patterns on: oodesign.com.
FactoryPattern.com is just another blog about the same old fashioned object oriented design and this where the name came of.