Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Abstract Factory pattern -practical use

Posted on 2006-11-19
9
Medium Priority
?
670 Views
Last Modified: 2006-11-22
Dear experts

Can some one explain a practical scenario where Abstract factory could be used. (other than DAO). if any one has implimented abstract factory in their current project, i would grealty appreciate if they could share their experience.

thanks
J
0
Comment
Question by:jaggernat
  • 3
  • 3
  • 3
9 Comments
 
LVL 10

Expert Comment

by:mbvvsatish
ID: 17977309
i havent used it in my projects till now.
but here is a real world example
http://www.design-nation.net/en/archives/000411.php
0
 
LVL 10

Accepted Solution

by:
mbvvsatish earned 1000 total points
ID: 17977347
0
 
LVL 8

Expert Comment

by:reach2piyush
ID: 17977919
A classic scenario is from Swing for setting the Look & feel for various elements like Buttons / Text Boxes / Frames etc.

Consider setting the look and feel as an factory class based on a selection criteria for Motif / Windows, etc.
to create different factory classes for Button.

Button has a factory class to create different type of buttons
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 10

Author Comment

by:jaggernat
ID: 17980708
thanks

this is my j2ee project flow.

jsp --> business delegate (use singleton) --> service locator -->ejb --> DAO --> ibatis --> db2.

where do you guys think i can make use of abstract factory patern? any ideas/inputs appreciated

thanks
0
 
LVL 8

Assisted Solution

by:reach2piyush
reach2piyush earned 1000 total points
ID: 17984436
abstract factory is ana creational pattern, most of the times it can be used along with your domain model objects

Consider a banking domain model, You may have Individual / Corporate / Joint Accounts
& then all these types can be further classified as Savings Account / Current Account / Credit Account, etc.

In case you decide to model these as classes rather than attributes, then you can use Abstract Factory to create an instance of IndividualSavingsAccount & so on..
An AccountFactory will give you IndividualFactory / CorporateFactory ...
IndividualFactory will give you  IndividualSavingsAccount...
0
 
LVL 10

Author Comment

by:jaggernat
ID: 17989053
ok thanks

does EjbHome fall under Abstract Factory? I think it falls under Factory method pattern right?

J
0
 
LVL 8

Expert Comment

by:reach2piyush
ID: 17992328
yup.. i also have the same idea.
EJbHome exhibits Factory pattern rather than Abstract Factory for creating EBJ Remote objects
0
 
LVL 10

Expert Comment

by:mbvvsatish
ID: 17993457
yeah thats correct.
0
 
LVL 10

Author Comment

by:jaggernat
ID: 18000727
thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question