home links tools blog about

« VB.NET Sucks | Main | ReverseDOS 2.9 Released »

November 04, 2005



I totally agree that as far as patterns go, the singleton is awesome for web apps (I used this twice in my state module recently).

Any particular reason you left the constructor public instead of private or protected? Just wondering (obviously intentional as you pointed this out in your drawback).

Michael K. Campbell

"Any particular reason you left the constructor public instead of private or protected?"

Uhhhh. Cuz my brain was obviously unplugged. I was sorta clued in to that down below... but... well. yeah.


You really should update this example with concurrency issues addressed.

If your site gets hit with 50 requests at roughly the same time and all spend a millisecond or two in IO operations reading your config file, you'll have your "singleton" get created up to 50 times.

Michael K. Campbell

Good call Adam. Thanks for the feedback.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment

Comments are moderated, and will not appear until the author has approved them.

Your Information

(Name is required. Email address will not be displayed with the comment.)