• Post Reply Bookmark Topic Watch Topic
  • New Topic

Factory Pattern - help needed !!!!

 
R Sawant
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
What exactly is the advantage of using Factory pattern ? When this pattern is useful ? Any useful tutorial(with examples) for Factory pattern ? Thanks in advance.

Ramdas.
 
rehans oberoi
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are using factory pattern ,
when we want to genearalize the concept,
we can generalize by making an interfce.
i mean to say , making a core interface .called factory
and than extend it according to requirments
does it make some sense
 
Bert Bates
author
Sheriff
Posts: 8919
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now I don't want anyone to think that we have anything against the Factory pattern, because we don't! It's a great pattern, Gamma used it all the time

But, it's not on the SCWCD exam! For the exam you need to learn these J2EE patterns:

- Business Delegate
- Service Locator
- Transfer Object
- Intercepting Filter
- MVC
- Front Controller

If you see any other patterns mentioned on the exam you'll know that they are "distractor" answers, not the real answer!

hth,

Bert
 
Raghu Shree
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The factory pattern is a creational pattern. Think the follwing scenario to used factory pattern

1. When the class doesn't know which class of object to be create.
2. A class specifies its subclasses to specify which class object to be create.
3. Based the value the subclass decide to create the specified object.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!