Factory Methods - I

7 September 2008

Knowing 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 ….

del.icio.us:Factory Methods - I  digg:Factory Methods - I  spurl:Factory Methods - I  wists:Factory Methods - I  simpy:Factory Methods - I  newsvine:Factory Methods - I  blinklist:Factory Methods - I  furl:Factory Methods - I  reddit:Factory Methods - I  fark:Factory Methods - I  blogmarks:Factory Methods - I  Y!:Factory Methods - I  smarking:Factory Methods - I  magnolia:Factory Methods - I  segnalo:Factory Methods - I  gifttagging:Factory Methods - I

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

Leave a Reply