• 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

Connection Factory MVC

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I wanna know, according to the MVC, where should I put my Connection Factory class?
controller package? util package? connection package? dao package?
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Breno,

In my opinion, MVC and Factory classes are 2 different paradigms and I necessarily dont see a connection from which one can generalize something.

MVC stands for Model(DAO and Data layer), View(JSP, HTML, Presentation layer) and Controller(The layer that connects View and Model). Its a classic design technique to build an application. It separates areas of concern, i.e., you have 3 separate layers, and it promotes loose-coupling, extensibility and re-usability. What that means is, is that you can work on any layer without affecting the other layers.

A Factory is a design pattern where in you delegate the creation of objects to a factory class. So in case I need to create an object, I can place a request to the factory and its the factory which will perform some logic and give me the created instance. This gives more of an authority to the factory and gets rid of spurious creation of objects.

So, you can use the factory class across any of the layers. If you wanted a factory for the DAO classes, you can use the DAOFactory class. If you want it at the controller level you can create a ControllerFactory and so on.

The way that I follow is to have a factory package and put all my factory classes into that package.
reply
    Bookmark Topic Watch Topic
  • New Topic