This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I am looking for a tutorial that can help me find out everything about factory classes .As far as meaning is concerned it is Classes that follow the factory method pattern
Whether this topic can be coverered in SCJP or not I am not much sure about it?
As far as I am concerned I am preparing for SCJP 1.6
Probably, I can try from my experience with others.
Basically, you are trying to create (instantiate) an object (of product) without directly calling the (product) class constructor by the client. Hence you create some client-helper-type (which is why you may need an interface, the Factory) that would call another interface that represent the Product super-type.
The basic objective of factories, which might be abstract factory, factory method, ... is to decouple the client from constructing a product. This is achieved by the above approach. In many practical apps, you have two super-types as interfaces: the Factory and the Product. Then you add concrete types to both of them, with the Factory meant to create the Product. Finally, your code becomes less brittle and more maintainable.
Hope, I was able to respond to your philosophical query.
Pranab Das, PMP, SCEA
Joined: Jun 30, 2008
Sorry, I forgot to add my humble suggestion for you to take time to read the Design Patterns by the GoF, which can provide you all information that you might need.
Some people find the HFDP useful; however, personally, I find it difficult reading because it is too full of lengthy examples and funny pictures. Apart from some patterns missing, content-wise, HFDP covers the GoF patterns.