Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Abstract Factory pattern -practical use

Posted on 2006-11-19
9
Medium Priority
?
669 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

719 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