View RSS Feed

Factory Pattern

Factory Pattern in Java

  1. Class Registration - using reflection

    by , 03-09-2012 at 08:11 PM
    Registration of the new product class could be done to the factory in case you use reflection (e.g in .NET languages or Java), without making any change in factory itself.Without being aware of the object type for creation of the objects in factory class, a map is kept b/w class type and productID. In this particular case, when new product gets added to the application then it shall be made registered to factory. No change is required in factory class code for this kind of operation.
  2. Factory Pattern Applicability & Examples

    by , 03-09-2012 at 08:09 PM
    Factory pattern is most widely used pattern.

    E.g, graphical applications do their work along with shapes. In implementations, shapes are products and drawing frameworks are the clients. An abstract shape is responsible for the derivation of the shapes. Shape class defines the move operations and draw that shall be implemented by concrete shapes. Now let us assume that a particular command has been selected from menu so that to make a new circle. Shape type is being received by the ...
  3. Factory Pattern

    by , 03-09-2012 at 08:07 PM
    Most widely used design pattern is the Factory design pattern in modern programming languages, for example C# and Java. It comes in many different implementations and variants. If you are seeking them you will probably find out certain references regarding GoF patterns: Abstract Factory & Factory Method.
    Commonly used factory patterns are defined here and also you might check out the similar original factory method patterns.
    • Without exposure of the instantiation logic, objects
    Factory Pattern