Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Facatory Methods

 
chaitanya krishna
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
pls tell about what is mean by factory methods...
what is purpose...
give me some example regarding Factory methods

regards
krishna
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Factory method is one of the Gang of Four's creational patterns. The purpose of the pattern is to define an interface for creating objects - but let the subclasses decide wich class to instantiate.

Take a look at http://www.fluffycat.com/java/JavaNotes-GoFFactoryMethod.html
for some source code.

If you need more, then try to ask google - you'll get plenty of hits.

/Svend Rost
 
Charles McGuire
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JavaBean stores information.

A FactoryBean works with a JavaBean and contains the CRUD (create, read, update, and delete) methods and JDBC code.

The good part about FactoryBeans is that they keep your JavaBeans from being cluttered up with CRUD methods and JDBC code.

The bad part about FactoryBeans is that you have twice as many classes.

If you are not using separate FactoryBeans now, you probably have all the JDBC, and CRUD methods in your one JavaBean right now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic