Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code cleanup branch
08-04-2006, 08:38 PM,
#23
 
Leave them as globals. :-)

Quote:The thing I like about singletons is they are created on first use

... that sort of "feature" seems pretty annoying if you're trying to figure out when your data is actually being created, since it will just be buried within whatever function happens to call a GetInstance() type function first.

So, the things I don't like about singletons:
1) extra typing
2) the data is created whenever the singleton is first accessed (which is not easy to find out)
3) they use static data

I'm not sure what you guys perceive as the advantages beyond 2 up there, which I see as a disadvantage. Additionally, the use of static data (3) is no cleaner than using globals. Thelusiv, it sounds like your main problem with using global data is that it muddies up your namespace. That can be easily solved, though, by just putting the global vars inside their own namespace. That also gives you the option of doing a using namespace blah; to save on typing if you don't mind worrying about namespaces. Thelusiv, your other idea of putting all publics into a VGAME class would work too.

Most of all, using singletons would require a lot of re-writing -- again, with (as I see it) no benefits, and even disadvantages. This seems like a total waste of time, since there so many much more ugly and disorganized things in the code that need to be fixed. It sounds like you aren't interested in making the code more usable or clean, but rather trying to purge globals because you heard from a CS class / website / your friend they're a no-no (which seems silly, by the way, since singletons use static data, an even bigger no-no).
Reply


Messages In This Thread
Code cleanup branch - by thelusiv - 08-01-2006, 01:46 AM
[No subject] - by FFuser - 08-01-2006, 05:34 AM
[No subject] - by joevenzon_phpbb2_import3 - 08-01-2006, 08:28 PM
[No subject] - by thelusiv - 08-01-2006, 08:39 PM
[No subject] - by alex25 - 08-01-2006, 11:38 PM
[No subject] - by thelusiv - 08-03-2006, 12:31 AM
[No subject] - by joevenzon_phpbb2_import3 - 08-03-2006, 10:28 PM
[No subject] - by thelusiv - 08-03-2006, 10:33 PM
[No subject] - by thelusiv - 08-03-2006, 10:33 PM
[No subject] - by matthew_i - 08-04-2006, 01:20 AM
[No subject] - by matthew_i - 08-04-2006, 01:20 AM
[No subject] - by thelusiv - 08-04-2006, 01:38 AM
[No subject] - by thelusiv - 08-04-2006, 01:38 AM
[No subject] - by matthew_i - 08-04-2006, 01:41 AM
[No subject] - by matthew_i - 08-04-2006, 01:41 AM
[No subject] - by thelusiv - 08-04-2006, 01:53 AM
[No subject] - by thelusiv - 08-04-2006, 01:53 AM
[No subject] - by matthew_i - 08-04-2006, 01:58 AM
[No subject] - by matthew_i - 08-04-2006, 01:58 AM
[No subject] - by thelusiv - 08-04-2006, 09:08 AM
[No subject] - by thelusiv - 08-04-2006, 09:08 AM
[No subject] - by joevenzon_phpbb2_import3 - 08-04-2006, 08:38 PM
[No subject] - by joevenzon_phpbb2_import3 - 08-04-2006, 08:38 PM
[No subject] - by matthew_i - 08-06-2006, 02:43 PM
[No subject] - by matthew_i - 08-06-2006, 02:43 PM
[No subject] - by joevenzon_phpbb2_import3 - 08-06-2006, 07:45 PM
[No subject] - by joevenzon_phpbb2_import3 - 08-06-2006, 07:45 PM
[No subject] - by matthew_i - 08-06-2006, 11:25 PM
[No subject] - by matthew_i - 08-06-2006, 11:25 PM
[No subject] - by joevenzon_phpbb2_import3 - 08-07-2006, 09:26 AM
[No subject] - by joevenzon_phpbb2_import3 - 08-07-2006, 09:26 AM
[No subject] - by thelusiv - 08-07-2006, 04:43 PM
[No subject] - by thelusiv - 08-07-2006, 04:43 PM
[No subject] - by clytle374 - 08-07-2006, 04:51 PM
[No subject] - by clytle374 - 08-07-2006, 04:51 PM
[No subject] - by thelusiv - 08-07-2006, 06:25 PM
[No subject] - by thelusiv - 08-07-2006, 06:25 PM
[No subject] - by clytle374 - 08-08-2006, 12:47 AM
[No subject] - by clytle374 - 08-08-2006, 12:47 AM
[No subject] - by thelusiv - 08-08-2006, 09:05 AM
[No subject] - by thelusiv - 08-08-2006, 09:05 AM
[No subject] - by clytle374 - 08-08-2006, 07:19 PM
[No subject] - by clytle374 - 08-08-2006, 07:19 PM

Forum Jump:


Users browsing this thread: 23 Guest(s)