Re: Questions for the 'Terminology FAQ'.



Zach Frey <zfrey bright net> writes:

> > About the definition of the factory. Would it be ok to say that a Factory is
> > like a 'librarian' for a 'library' (group of related) of objects?
> 
> No, in fact this is a very misleading way to look at it.
> 
> A factory is an object that creates other objects.
> 
> A factory is *not* a collection of objects.  Generally, factory objects
> do not track references to their created objects (I'm assuming that
> Bonobo factories do not; I scanned the code and couldn't see where
> they might.)

Well, sometimes they hold a count on them.

For instance in eog/viewer/main.c, the factory connects to the "destroy"
signal of all objects it creates and calls gtk_main_quit() when all of them
are gone.

However, it doesn't keep any references to the objects, it just keeps a count
how many of them are alive so that it can exit nicely.

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]