Factory Methods - I
7 September 2008Knowing and using design patterns is very important when working in professional environment. In the next few posts, I’ll be writing about Factory methods.
Simply stating, Factory method is a method that instantiates objects. It is quite similar to a factory and its job is to create objects. Let me present an example to clarify things. We have an interface named Trace with 2 implementations.
Interface Trace is presented below with 3 method signatures.
public interface Trace { public void setDebug( boolean debug ); public void debug( String message ); public void error( String message ); }
There are 2 implementations of Trace. One writes the messages to the command line and the another writes them to a file.
continued ….
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Factory Methods - I