|
Abstract Factory Pattern using Java
|
|
01-22-2010, 02:16 PM
Post: #1
|
|||
|
|||
|
Abstract Factory Pattern using Java
Factory Pattern is a widely used efficient pattern that eliminates the need of Constructing objects in the client code. Instead the Factory creates and delivers objects as required by the client. This method eliminates the need to instantiate (use the new keyword) with a client code.
A small example demonstrates this pattern. Beverage.java Code: public interface Beverage {Tea.java Code: public class Tea implements Beverage {Coffee.java Code: public class Coffee implements Beverage {Code: public abstract class BeverageFactory {FactoryTest.java Code: public class FactoryTest {Shazin Sadakath Bsc (Hons) Software Engineering (UG) SCJP 1.5 |
|||
|
« Next Oldest | Next Newest »
|


Search
Member List
Calendar
Help


