Thursday, February 24, 2005

Using Patterns

The factory pattern, this is a reminder to myself to use the Factory pattern, also for others, pretty simple, There is normally an interface, an implementation and a Factory object, the Factory object will return the Interface, which is an implementation of some Object.

public class CrawlerFactory {

public static Crawler load(String initDir) {

Crawler c = new Crawler(initDir);
c.process();
return c;

} /// end of the method //

} /// end of class //



public class Crawler {

String initialDir = null;

public Crawler(String initDir) {

initialDir = initDir;

} /// end of the cons //

public void process() {

} /// end of the method ///

} /// end of the class //

0 Comments:

Post a Comment

<< Home