patterns-discussion AT lists.siebelschool.illinois.edu
Subject: General talk about software patterns
List archive
- From: Ashish Harigopal Poddar <ahpoddar AT mailbox.syr.edu>
- To: patterns-discussion <patterns-discussion AT cs.uiuc.edu>
- Subject: RE: [patterns-discussion] deleting a Singleton
- Date: Sun, 3 Oct 2004 16:46:34 -0400
- List-archive: <http://mail.cs.uiuc.edu/pipermail/patterns-discussion>
- List-id: General talk about software patterns <patterns-discussion.cs.uiuc.edu>
Hi,
singleton does not defines the lifetime of the class i agree to that.. but
what i was suggesting was that logically speaking, the singleton object
should
not be destoyed in between the life of the application, because that wud
distort the basic idea of the pattern, because others demanding a copy after
that wont get the same copy.
about the resource management in the singleton object, that is purely a
design
issue about which patterns are normally silent. hence the singleton object
(though will be the same) but occupies different instances of that resource
at
different times is a different story.
only thing that might vary the lifetime of the singleton object wud be the
creation time as i mentioned in earlier mail!
comments anyone?
with regards,
Ashish.
>===== Original Message From "Eric Y. Theriault"
><eric AT eyt.ca>
> =====
>Peter Horan wrote:
>
>> Perhaps, logically, a singleton should not be destroyed, otherwise, it
>> is possible to create a different instance of the singleton.
>
>
>Yes, but does a Singleton pattern define the lifetime of the class? No,
>it only states that there will only be one instance of the class. There
>are several different types of Singletons, and while many Singletons
>have long lives, there are some particular needs for short lifetimes. I
>lack a clear example, but think of a Singleton that is used in a file
>parser or some genre of algorithm that is a small portion of the
>application; similar to how Design Patterns states in the Consequences
>that you can easily turn this pattern into a Multiton (multiple
>instances from a controlled entry point), the design pattern need not be
>interpreted as a single instance for the lifetime of the application
>(one instance for the entire application), but could also be interpreted
>as a single instance of an object at a given time (only one instance at
>any given time, but many instances over the application lifetime).
>
>Furthermore, when an object's lifetime is the lifetime of the
>application's, it can still be important to release the resources that
>the Singleton holds, as previously mentioned on the forum.
>
>Although the design pattern does not discuss the destruction of the
>object, this is as important as the pattern itself.
>
>
>
>eyt*
>--
>Eric Y. Theriault
>http://www.eyt.ca
>
>_______________________________________________
>patterns-discussion mailing list
>patterns-discussion AT cs.uiuc.edu
>http://mail.cs.uiuc.edu/mailman/listinfo/patterns-discussion
-------------------------------------------------------------
The secret of creativity is knowing how to hide your sources.
- Albert Einstein.
Ashish Poddar
525 Euclid Avenue,
Apartment #2,
Syracuse - 13210, NY.
Ph. (315) 278 4241
- Re: [patterns-discussion] deleting a Singleton, Peter Horan, 10/01/2004
- Re: [patterns-discussion] deleting a Singleton, Eric Y. Theriault, 10/02/2004
- <Possible follow-up(s)>
- Re: [patterns-discussion] deleting a Singleton, Carl G. Alphonce, 10/02/2004
- RE: [patterns-discussion] deleting a Singleton, Ashish Harigopal Poddar, 10/03/2004
- Re: [patterns-discussion] deleting a Singleton, Eric Y. Theriault, 10/03/2004
- RE: [patterns-discussion] deleting a Singleton, Sriram Gopalan, 10/04/2004
Archive powered by MHonArc 2.6.16.