aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What is a factory class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What is a factory class?" Watch "What is a factory class?" New topic
Author

What is a factory class?

Bindu Puvvala
Greenhorn

Joined: Feb 16, 2006
Posts: 12
Book says java.util.Collections is a factory class. What is a factory class at all?
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
A factory class is a standard design pattern that gives you the ability to manufacture classes as needed.
Bindu Puvvala
Greenhorn

Joined: Feb 16, 2006
Posts: 12
Do you mean a factory class can be used as a base class, from which required classes can be derived?
Priya Balaraman
Greenhorn

Joined: Jul 13, 2005
Posts: 6
absolutely. U state your requirements and it shall be manufactured
Marcus Green
arch rival
Rancher

Joined: Sep 14, 1999
Posts: 2813
"Do you mean a factory class can be used as a base class, from which required classes can be derived?"

That doesn't really encapsulate the expectations of what a factory class is,

"The Factory Pattern is all about "Define an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses" Thus, as defined by Gamma et al, "The Factory Method lets a class defer instantiation to subclasses".

http://gsraj.tripod.com/design/creational/factory/factory.html

However the SCJP exam has absolutely no expectation of an understanding of Design Patterns so don't worry about it too much. Design patterns are a big deal in the world of Java programming, but not the SCJP. Design Patterns are covered by the SCWCD exam (but as it so happens not the Factory pattern).


SCWCD: Online Course, 50,000+ words and 200+ questions
http://www.examulator.com/moodle/course/view.php?id=5&topic=all
 
wood burning stoves
 
subject: What is a factory class?