ContactUs :

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

Why Factory ?

If we are not using the instance variables in the methods then the first way is to declare all the methods as static. The second way is to implement the SingleTon, suppose if there are 2 dao classes then in both the classes we need to implement the SingleTon, instead of implementing the SingleTon in both the dao’s we can implement the Factory design.

Factory is used to produce the objects it can be singleton or non-singleton.

                        1.create the objects using the static in the factory class.

                        2.write the static methods to return the objects.

Note : If there is a single class with less no of methods then use static. If there is a single class with so many methods then implement the SingleTon. If there are N number of similar kind of classes then implement the Factory.

Related Posts Plugin for WordPress, Blogger...
Flag Counter