Solved

Abstract Factory pattern -practical use

Posted on 2006-11-19
9
658 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
thymeleaf natural templating vs JSP 2 106
java.io.BufferedReader   readLine()  //returns the entire file ? 4 76
Java DateChooser? 3 37
split string containing \r\n in Java 46 44
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

832 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