• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Real Time Scenario For Singleton Desgnpatter and DAO design pattern

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

Can someone please give me example of a real time scenario where Singleton Desgnpatter and DAO design pattern is used
 
Ranch Hand
Posts: 77
Android MyEclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Deepak,

First i will go for Singleton

there is a funtionallity where you are getting Meta Data on to the form, so if you hit database for every time it is overhead to server. Instead get the data for first time and keep it in cache and use it for everytime untill the Meta data is not changed, if data is changed clear it and again get it from database.

Now DAO pattern

you have a application connecting to different databases like oracle,DB2and MSSQL etc
for the above you have get connections and do some stuff for persisting the data. So for all 4 database you will have to get the 4 connection object , it means there will be 4 classes for getting connection mechanism.
Instead doing such redendunt code, have a factory class , which will give you connection object depending upon database you using .

Damodar
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic