This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Uses of Abstract Factory... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Uses of Abstract Factory..." Watch "Uses of Abstract Factory..." New topic
Author

Uses of Abstract Factory...

Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
In Creational Patterns, where we can use Abstract Factory patterns. what is the diff. b/w Abstract Factory and Factory method.


SCJP 1.5, SCEA, ICED (287,484,486)
Avijeet Dash
Ranch Hand

Joined: Jan 21, 2001
Posts: 148
Imagine supporting two windowing environments, Microsoft Windows´┐Żand the X Window System.
Create an Abstract Factory class WindowFactory defining methods like #createButton. Add subclasses MSWindowFactory and XWindowFactory which implement #createButton to answer instances of MSButton or XButton respectively. A window painter can then be given an instance of MSWindowFactory or XWindowFactory. Sending it the #createButton message will result in an instance of MSButton or Xbutton. Assuming they respond to the same protocol, the client can remain ignorant of the class of the resultant button.
Abstarct Factory Class: WindowFactory
FactoryMethod(s): newWindow() which will return either MSWindowFactory or XWindowFactory. and createButton().
 
Don't get me started about those stupid light bulbs.
 
subject: Uses of Abstract Factory...