• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using a Factory Pattern in a Web Based Application

 
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,



I had understood what is a Factory Pattern with the above example.
Can anybody please tell , how an Factory Pattern would be useful in a WebBased application .
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put your code in web-base application .
 
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only difference between a web based app and an ordinary app is how the user accesses your application.

It has got nothing to do with the way you implement your "business logic". So, well, yeah, like Kenkag mentioned, put your factory pattern in a web application
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes , its a silly doubt .THanks
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the question should be changed from "how an Factory Pattern would be useful in a WebBased application" to "why or when we need to use Factory Pattern". The beauty of the Factory Pattern is you can "inject" new implementation to your system without large scale change. Factory Pattern encapsulate (or hide away) the creation of the real instance. That means, if you need to provide different sub-class of the class or interface, you don't need to change large segment of code.

As your example, if you need to introduce new kind of Person (e.g. ET), you just need to change one place (the "getDetails(..) function).
 
reply
    Bookmark Topic Watch Topic
  • New Topic