• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Question about design pattern

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are creating a web application for an online product ordering system. You have decided to use connection pooling to reduce load on the databases. Since you have many databases, you want to create one pool instance of the ConnectionPool class for each database. Depending on what is requested, you may have to connect to a variable number of databases. What pattern should you use?
a) Abstract factoryb) Factory Method
c) Builder d) Prototype
e) Singleton


The correct answer is Singleton but i think it should be abstract factory?
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Apratim Khandalkar:
You are creating a web application for an online product ordering system. You have decided to use connection pooling to reduce load on the databases. Since you have many databases, you want to create one pool instance of the ConnectionPool class for each database. Depending on what is requested, you may have to connect to a variable number of databases. What pattern should you use?
a) Abstract factoryb) Factory Method
c) Builder d) Prototype
e) Singleton
The correct answer is Singleton but i think it should be abstract factory?



I think Singleton is the answer since each of the delegating component (say different sub-systems of the ordering system) would know the DB to connect to and it cannot be from a centralized place (i.e. We get to mention the target DB to connect to from the controller) in which case Abstract Factory would be correct answer!!
[ May 04, 2006: Message edited by: Bajji Pat ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic