Solved

Abstract Factory pattern -practical use

Posted on 2006-11-19
9
650 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 250 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 8

Assisted Solution

by:reach2piyush
reach2piyush earned 250 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now