File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes Help for Factory Design pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Help for Factory Design pattern" Watch "Help for Factory Design pattern" New topic
Author

Help for Factory Design pattern

sunil antil
Greenhorn

Joined: Jul 23, 2009
Posts: 20
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
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3056
    
  33

I think this query is similar to previous query you had posted.
Please continue in the previous thread if its same.


Mohamed Sanaulla | My Blog
sunil antil
Greenhorn

Joined: Jul 23, 2009
Posts: 20
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
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4240
    
    7

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help for Factory Design pattern
 
Similar Threads
Design Patterns -SCEA
Inversion of control
Factory design pattern
Design Patterns...
here we go again - design patterns from hell