Solved

Abstract Factory pattern -practical use

Posted on 2006-11-19
9
656 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

929 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

13 Experts available now in Live!

Get 1:1 Help Now