Skip to main content
gamedev.net
🔒 Locked

singletons?

Started by Dark Rain 5 replies 700+ views
Original Post
Dark Rain
Dark Rain
I''ve been called an uneducated college idiot by my university teacher today in the software engineering class because I said I thought a static class with static functions was a valid kind of singleton. Now I don''t have my GOF book on hand and won''t till the week-end but I''m not too sure it doesn''t fit the definition of a singleton. Anyone got a take on the issue? I''d also ask why a lot of my university teacher look down so much on people who did their CS in college but that''s for general discussion I guess
SabreMan
SabreMan
quote:
Original post by Dark Rain
I've been called an uneducated college idiot by my university teacher today in the software engineering class because I said I thought a static class with static functions was a valid kind of singleton.

Now I don't have my GOF book on hand and won't till the week-end but I'm not too sure it doesn't fit the definition of a singleton. Anyone got a take on the issue?

The Singleton anti-pattern ensures that only one instance of a particular class can be created, and that it is globally accessible. Does your suggestion meet both of those criteria?
quote:

I'd also ask why a lot of my university teacher look down so much on people who did their CS in college but that's for general discussion I guess

Because you're an uneducated college idiot, presumably.



[edited by - SabreMan on October 17, 2003 11:03:21 AM]
Shannon Barber
Shannon Barber
There's only one singleton design pattern, you described an implementation. It could be an example implementation iff one of the static members was a pointer to an instance.

[edited by - Magmai Kai Holmlor on October 18, 2003 11:03:40 PM]
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
antareus
antareus
quote:
Original post by Dark Rain
I''d also ask why a lot of my university teacher look down so much on people who did their CS in college but that''s for general discussion I guess

Maybe because they didn''t get the chance to go to college, or they think that college doesn''t teach CS as well as it could.
--God has paid us the intolerable compliment of loving us, in the deepest, most tragic, most inexorable sense.- C.S. Lewis
paulecoyote
paulecoyote
Hi there,
I wrote an article on codeproject about Singletons. There is another more recent example too:

Singleton Template

If the link doesn't work try again later - I think the codeproject site may be going under some maintaince or something

Cheers,

Paul


[edit: clicky]

[edited by - Magmai Kai Holmlor on October 21, 2003 12:33:37 PM]
Anything posted is personal opinion which does not in anyway reflect or represent my employer. Any code and opinion is expressed “as is” and used at your own risk – it does not constitute a legal relationship of any kind.
superpig
superpig
It''s the equivalent of a bunch of regular global C functions. You''ve just put those functions in a slightly different namespace. Not a Singleton; you''re never creating an instance of the class, and if you are, you''re not ensuring it can only be done once.

Richard "Superpig" Fine
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4
ry. .ibu cy. .y''ybu. .abu ry. dy. "sy. .ubu py. .ebu ry. py. .ibu gy." fy. .ibu ny. .ebu
OpenGL is a language
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
Bagpuss
Bagpuss
At the end of the day, who the F**k is he to look down on you ?
You are there to learn, and by being slagged off by the lecturer you will not learn, rather probably develop an antipathy towards him.

OK, sorry this isn''t directly SW Eng, but attitudes by lecturers such as that are plain wrong and don''t help.

Just make sure that you do your best now, and then make shure that the idiot realises he didn''t help you get where you are.

GL,

K

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.