Boost logo

Boost :

From: Michael Kenniston (Msk_at_[hidden])
Date: 2001-08-13 07:59:20

John Max Skaller and Bill Kempf wrote:
> > I believe every single use of static variables
> > and singletons is BAD DESIGN.
> Well, I don't agree. <snip> there are several
> classes of designs that simply can't be coded with out the use of
> global data.
> > Show me one. I've never seen one. I've never used
> > global data (not since the '70's anyhow).
> > [lexical scanner example snipped]

While I don't have enough experience with singletons to
convincingly argue either side, I do have enough experience
to find this discussion very interesting, especially when it
includes specific examples like the lexical scanner.

Personally I'd like to see the debate continue, with additional
cases proposed as requiring singletons or static variables, and
rebuttals showing how/why they can/should be avoided (although
perhaps we should let Mr. Kempf finish the threads library
first :-). We might not "resolve" the issue to everyone's
satisfaction, but it could still be very enlightening and help
many of us raise the level of our design skills. Even if nobody
is brave enough to attempt an implementation of a boost singleton
library right now (and I know I'm not), this discussion could lay
the foundation for some documentation for it that supplies examples
of when singletons should and should not be used and why.

- Michael Kenniston

Boost list run by bdawes at, gregod at, cpdaniel at, john at