A coworker has brought up the following quote from a book as
confirmation that we cannot use Singletons in ASP.Net application
code, at least at the ASP.Net tier.
I am looking for references to other documentation that confirms this
quote or refutes it or expert comment on whether to use a Singleton in
the ASP.Net web projects.
The following quote is from the book Programming Distributed
Applications with COM+ and Microsoft Visual Basic 6.0, Second Edition,
by Ted Pattison, Microsoft Press, 2000.
"An object that is shared across multiple clients is often called a
"singleton". Developers typically design with singletons in order to
share data across multiple clients. While the use of singleton objects
might be acceptable in some single-user scenarios, you should
definitely avoid it in COM+ applications. Every client should get its
own private objects. If multiple clients require access to the same
data, you should store this data in shared memory or in a database.
You can then devise a design in which each client creates a private
object that accesses this shared data." -- Chapter 7 "Sharing
Resources in a COM+ application".
I disagree with him as I have used Singletons before in ASP.Net code
and I thought they were working as intended. I haven't seen any
authoritative statement on MSDN or elsewhere, written specifically in
the context of ASP.Net and the .Net Framework that would indicate that
Singletons are incompatible with ASP.Net and cannot provide the
typical benefits of Singletons when used in ASP.Net Web Projects.
Thanks much,
Rick 2 1296
The quote does not say that you CANNOT use singletons in ASP.NET, what
it is doing is trying to DISCOURAGE the use of singletons in ASP.NET
and other server based applications. Singletons can be difficult to
implement and maintain, and can be the source of bottlenecks in server
side code.
--
Scott http://www.OdeToCode.com/
On 30 Sep 2004 07:47:28 -0700, rk*******@earthlink.net (Rick) wrote: A coworker has brought up the following quote from a book as confirmation that we cannot use Singletons in ASP.Net application code, at least at the ASP.Net tier.
I am looking for references to other documentation that confirms this quote or refutes it or expert comment on whether to use a Singleton in the ASP.Net web projects.
The following quote is from the book Programming Distributed Applications with COM+ and Microsoft Visual Basic 6.0, Second Edition, by Ted Pattison, Microsoft Press, 2000.
"An object that is shared across multiple clients is often called a "singleton". Developers typically design with singletons in order to share data across multiple clients. While the use of singleton objects might be acceptable in some single-user scenarios, you should definitely avoid it in COM+ applications. Every client should get its own private objects. If multiple clients require access to the same data, you should store this data in shared memory or in a database. You can then devise a design in which each client creates a private object that accesses this shared data." -- Chapter 7 "Sharing Resources in a COM+ application".
I disagree with him as I have used Singletons before in ASP.Net code and I thought they were working as intended. I haven't seen any authoritative statement on MSDN or elsewhere, written specifically in the context of ASP.Net and the .Net Framework that would indicate that Singletons are incompatible with ASP.Net and cannot provide the typical benefits of Singletons when used in ASP.Net Web Projects.
Thanks much, Rick
Rick wrote: A coworker has brought up the following quote from a book as confirmation that we cannot use Singletons in ASP.Net application code, at least at the ASP.Net tier.
You can easily make a remotable object that uses a Singleton model. http://www.codeproject.com/dotnet/remotingsingleton.asp
Eric This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Uwe Mayer |
last post by:
Hi,
I've been looking into ways of creating singleton objects. With Python2.3 I
usually used a module-level variable and a factory function to implement
singleton objects.
With Python2.4 I...
|
by: cppaddict |
last post by:
Hi,
In this tutorial on singleton class in C++
(http://gethelp.devx.com/techtips/cpp_pro/10min/10min0200.asp) the
author gives two implementations of a simple singleton class, claiming
that...
|
by: Alicia Roberts |
last post by:
Hello everyone, I have been researching the Singleton Pattern. Since the
singleton pattern uses a private constructor which in turn reduces
extendability, if you make the Singleton Polymorphic...
|
by: Stephen Brown |
last post by:
I have some strange behavior on my web server that seems to point to garbage
collection. I have a singleton that tracks web activity on my web site.
The singleton works great, except that it...
|
by: Sharon |
last post by:
I wish to build a framework for our developers that will include a singleton
pattern.
But it can not be a base class because it has a private constructor and
therefore can be inherit.
I thought...
|
by: solex |
last post by:
Hello,
I am trying to model a session object that is essentially a collection of
different items (connection string, user name, maps etc.) I would like this
session object to be available to...
|
by: Raider |
last post by:
I need to have one object for each template argument(s) used. For
example, I need to have one object of int. I tried the following code
and it gives me all I want with Visual C++ 7.1. But is it...
|
by: Preets |
last post by:
Can anyone explain to me the exact use of private constructors in c++ ?
|
by: Daniel Kay |
last post by:
Hello,
currently I am reading the book "Effective C++ Third Edition" from Scott
Meyers. While Reading Item 4 (Make sure that objects are initialized
before they're used) I got an idea how to...
|
by: weaknessforcats |
last post by:
Design Pattern: The Singleton
Overview
Use the Singleton Design Pattern when you want to have only one instance of a class. This single instance must have a single global point of access. That...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |