• 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

Help for Factory Design pattern

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

Can any one tell what is the meaning of the following line

The lifetime management of the generated objects must be centralised to ensure a consistent behaviour within the application

in context with factory method desgin pattern.

Thanks!

S.E Sunil Kumar
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this query is similar to previous query you had posted.
Please continue in the previous thread if its same.
 
sunil antil
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mohamed Sir

Its ok querry may be similar but I did not get answer of both of my querry. I will say thanks we some one sort out me from this problem.


Thanks
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's difficult to tell exactly what was meant by a single quote with no context. But here's what I think it's getting at.

The clients that get objects from the factory cannot be responsible for managing the object's lifetime. Let's say that there's a cleanup method that needs to be called when the object is taken out of service. The client can't be responsible for this because it has no way of knowing whether the object is being shared with other clases, or whether it will be used again in the future. All this depends on what strategies the factory is using, and one point of the factory pattern is that clients don't need to know this.

So where can this "lifetime management" take place? It needs to be centralised somehow, probably in the factory itself.

(Here by "client" I just mean any classes that use the factory).

Does that help?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic