Page 1 of 1

Question on game structure? [Flame War]

Posted: Thu Dec 30, 2010 4:06 pm
by N64vSNES
Your first option would be a singleton

Code: Select all

class MyClass {

	public:

	~MyClass();
	static MyClass *GetInstance();

	private:
	static MyClass *MyInstance;

};

MyClass *MyClass::MyInstance = NULL;

MyClass *MyClass::GetInstance() {
	if ( MyInstance == NULL ) {
		MyInstance = new MyClass;
	}
	return MyInstance;
}
Then you can simply get this instance like so

Code: Select all

MyClass *MyClass = MyClass::GetInstance();
Then you can just refrence pointers the the static member and allways be using the same object rather than reallocating another.

However most Object Oriented obsessed programmers say this is bad design so you could instead use a similar method with a AssetManager

Code: Select all

class AssetManager {

	public:

	static MyClass *GetMyClass();

	protected:
	static MyClass *MyMyClass;

}

MyClass *AssetManager::MyMyClass = NULL;

MyClass *AssetManager::GetMyClass() {
	if ( MyMyClass == NULL ) {
		MyMyClass = new MyClass;
	}
	return MyClass;
}
If you want the super OO mad way then you would want to read GyroVorbis's post here:
http://thechaosrift.com/viewtopic.php?f ... f402e83056

Re: Question on game structure?

Posted: Thu Dec 30, 2010 4:53 pm
by Falco Girgis
Ignore N64vSNES. That's a terrible idea, a shitty design, and it should be avoided at all costs.
N64vSNES wrote:However most Object Oriented obsessed programmers say this is bad design so you could instead use a similar method with a AssetManager
What he meant to say was:
N64vSNES + More experience wrote:However most programmers who aren't complete dipshits and understand anything about good design or modularity of code would recommend any number of alternatives.
edit: Oh, and your example isn't even correct. If your (default) constructor is public, it isn't exactly a singleton now, is it?

Re: Question on game structure?

Posted: Thu Dec 30, 2010 5:52 pm
by Arce
N64vSNES, I have avoided reading the garbage you've posted in other topics, but now I cannot do so. =/

I am simply appalled by your response to a fellow developer asking a legitimate question (one that any beginner would have) with your haughty, highly opinionated and downright incorrect philosophies regarding both "Design Patterns" and concepts of "OO Design."

I don't tend to get mixed up in debates regarding "superior designs" as they are like arguing religion--your only basis is for what you believe will need to be added to you architecture in the future, and the empirical proof of past "Jesus's" (more experienced developers) claiming to have already found the light. However, you aren't arguing one design pattern over the other--you've picked one out that you've drawn favor to as it allows for incredibly simple architectures to quickly come to life with little overhead design, defend it as though it's your diety, yet are unable to display that you're competent enough to distinguish the subtle yet vital difference between "Design Patterns" and "Programming Paradigms."

I simply don't feel right allowing you to mislead the minds of readers. People like you are why the internet is plagued with a plethora of useless debates about "singletons" and their uses, yet don't seem to know where the design actually fits into software development methodologies. What I'm referring to is the repeated posts of yours I've seen like this:
However most Object Oriented obsessed programmers say this is bad design so you could instead use a similar method with a AssetManager
This blatantly ignorant statement shows immediately that you have had no formal (or informal) education in software engineering what-so-ever. You honestly should not be anywhere near new developers, as you need to sit down and get your definitions right.

One vital part to being a successful developer is communication. If you are unable to speak in programming terms, you really don't need to argue using them. This is especially applicable when your main defense for singletons is "other designs are overly OO" as though a singleton is not an OBJECT ORIENTED DESIGN PATTERN. :lol:

So, lets zero in and see why this one sentence warrants this entire, long response. First of all, you don't seem to understand what a Design Pattern is at all. I'm not going to spend my time linking or detailing the true definition in regard to software development, (as I can be doing something useful instead :lol:), but I'm sure if you're interested you can figure this out via google. What I will do, however, is point out the fact that "Object Oriented Design" is a design paradigm, not pattern, and a Singleton is a very specific Object Oriented design pattern requiring encapsulation and abstraction barriers. Your statement implies that Gyro's solution was somehow "more or less" object oriented than yours simply because they are more in-depth designs. This is absolutely absurd! There are plenty of procedural design patterns out there, yet you seem to have the misunderstanding that a Singleton is among them? ;p

KeithStoffel's question was a very broad and high level one regarding problems with accesss levels. This is nothing architectural and, quite frankly, shouldn't be answered with a design pattern. Instead, somebody may want to go about introducing him to some common design principals of access such as how to build a system with a higher level object containing/accessing lower, how to pass objects value/reference, how to aggregate, use composition, etcetcetc.
Instead, you've responded with a Design Pattern created to cater to a very specific situation in which it must be ensured that no more than one object can exist at all.

Why in the name of FLYING SPEGHETTI MONSTER would you do this? This is the metaphorical equivalent of being asked "How do I get from point A to Point B" and responding, "Well, you can either Jet Skii, which is done like this <insert example> or you can act like all the other fucking retards who prefer waterside forms of transportation in order to move <insert thread to larger discussion.>"

See what I did there?

Now the only question is...Why would you do this? Are you intentionally trying to confuse him? Of course not. You simply don't have a full understanding of the topic athand. The only reason you've suggested a "singleton" to him is because of global access. The only requirement in his question was "how do a bunch of things touch another thing." Nothing in there implies needing "one instance," dude. ;p

So, you literally just answered him by demonstrating that you don't understand what OO design is, don't know how to provide object access without globally scoping a reference, and don't know wen to use a singleton, how to implement it, and what exactly you think of all the biggots who actually do know what they're talking about.

Congratulations, I hope you're well!

EDIT: Edited for change in vibe + to be less douchebagish. ;p

Re: Question on game structure?

Posted: Thu Dec 30, 2010 6:01 pm
by XianForce
I smell something burning...

Re: Question on game structure?

Posted: Fri Dec 31, 2010 10:06 am
by N64vSNES
GyroVorbis wrote:Ignore N64vSNES. That's a terrible idea, a shitty design, and it should be avoided at all costs.
N64vSNES wrote:However most Object Oriented obsessed programmers say this is bad design so you could instead use a similar method with a AssetManager
What he meant to say was:
N64vSNES + More experience wrote:However most programmers who aren't complete dipshits and understand anything about good design or modularity of code would recommend any number of alternatives.
edit: Oh, and your example isn't even correct. If your (default) constructor is public, it isn't exactly a singleton now, is it?
First of all irrelevant of wether its a good design or a bad design I'm showing him ALL of the approaches he can take.

Second of all, when the fuck did I say its a good design? I asked ONCE in a completly diffrent thread why it was so bad.

Third, you can't tell me your so fucking low that your going to get cocky of a simple error that I forgot the contructor? Thats like forgetting a semicolon, its the most obviouse error you can make but everyone makes it. So stop being a whiney bitch and learn that the is multiple ways you can approach a task.
Arce wrote: N64vSNES, I have avoided reading the garbage you've posted in other topics, but now I cannot do so. =/
Ok here comes the blitz kiddie.....
Arce wrote: you've picked one out that you've drawn favor to as it allows for incredibly simple architectures to quickly come to life with little overhead design, defend it as though it's your diety, yet are unable to display that you're competent enough to distinguish the subtle yet vital difference between "Design Patterns" and "Programming Paradigms."
There you're saying exactly the same as Gyro, WHERE THE FUCK DID I SAY IT WAS A GOOD IDEA TO USE SINGLETONS?!?!

I'll admit you and Gyro are some of the more experianced programmers on this forums but that dosen't mean you can say "Don't do this because its a bad idea" How about stating why thats a bad idea? Otherwise the noobs will be saying "Yeah singletons are bad because............."

Don't say I didn't point out the alternatives because the is a goddamn link to a thread ABOUT SINGLETONS. I'm not going to be a complete asshole saying "This is your only option because the rest suck" I'm going to show people ALL of the options irrelevant of which is better.

Re: Question on game structure?

Posted: Fri Dec 31, 2010 10:15 am
by avansc
N64vSNES wrote:............
.........

Don't say I didn't point out the alternatives because the is a goddamn link to a thread ABOUT SINGLETONS. I'm not going to be a complete asshole saying "This is your only option because the rest suck" I'm going to show people ALL of the options irrelevant of which is better.
Dude don't sweat it to much, this is a case of two big fish in a very very small pond.

I'll probably get flack for that, but I think their attack was rather un warranted, but what ev, dont take it too personally man.

EDIT: Just wanna add that I am not contesting that their points on the subject are wrong, just that their attack was rather personal, they could have showed some decorum.

Re: Question on game structure?

Posted: Fri Dec 31, 2010 10:44 am
by Falco Girgis
N64vSNES wrote:
GyroVorbis wrote:Ignore N64vSNES. That's a terrible idea, a shitty design, and it should be avoided at all costs.
N64vSNES wrote:However most Object Oriented obsessed programmers say this is bad design so you could instead use a similar method with a AssetManager
What he meant to say was:
N64vSNES + More experience wrote:However most programmers who aren't complete dipshits and understand anything about good design or modularity of code would recommend any number of alternatives.
edit: Oh, and your example isn't even correct. If your (default) constructor is public, it isn't exactly a singleton now, is it?
First of all irrelevant of wether its a good design or a bad design I'm showing him ALL of the approaches he can take.
Excuse me? When somebody comes to these forums looking for help, I would like to at least have enough faith in humanity to believe that we would like to introduce a good solution to them. There are a million and a half shitty ways to do something in the programming world. People ask for help to find the good solutions.
N64vsSNES wrote:Third, you can't tell me your so fucking low that your going to get cocky of a simple error that I forgot the contructor? Thats like forgetting a semicolon, its the most obviouse error you can make but everyone makes it. So stop being a whiney bitch and learn that the is multiple ways you can approach a task.
And YOU can't tell me that you're so naive as to think that this was small mistake. You just defended singletons for three pages in the previous thread on the sole basis of "single object instantiation" then forget to make your constructor private? That is an aggregious mistake that completely alters the design you are presenting--not a trivial syntax error. That is not something that would have been intuitive for somebody who has never been introduced to the design to correct.
N64vSNES wrote:There you're saying exactly the same as Gyro, WHERE THE FUCK DID I SAY IT WAS A GOOD IDEA TO USE SINGLETONS?!?!
Ooooh, I don't know, maybe in the singleton topic where you literally spent three posts calling anybody who proved the design was shit object-oriented whores and refused to accept that there was anything wrong with the design?
N64vSNES wrote:I'll admit you and Gyro are some of the more experianced programmers on this forums but that dosen't mean you can say "Don't do this because its a bad idea" How about stating why thats a bad idea? Otherwise the noobs will be saying "Yeah singletons are bad because............."
Try because we just had another GIGANTIC topic on the matter (that you linked to) where YOU literally refused to accept anybody's input (until at least 3 pages in, but apparently that didn't stick with you at all).
N64vSNES wrote:Don't say I didn't point out the alternatives because the is a goddamn link to a thread ABOUT SINGLETONS. I'm not going to be a complete asshole saying "This is your only option because the rest suck" I'm going to show people ALL of the options irrelevant of which is better.
Do you realize how absolutely retarded your first sentence is? You pointed out alternatives to the singleton pattern by posting a link to a thread about singleton patterns. Really, bro?

When you present the alternative in a manner that literally insults its supporters followed by a quick link, that is not exactly being "unbiased" and representing all points of view, is it?

Not to mention what the fuck was your "AssetManager" code? How is that ANY different than the incorrect singleton code you had posted previously?

The bottom line is that this guy comes, asks for honest advice, you give him the shittiest possible solution (presented in the shittiest possible manner (it wasn't even correct)), after we had just discussed WHY this was a shitty solution (in a separate 3+ page thread), AND THEN you have the audacity to post a(n) (once again incorrect) alternative and present it in a manner that literally insults everybody who uses it? Where is the integrity in that?
avansc wrote:Dude don't sweat it to much, this is a case of two big fish in a very very small pond.
You're not worth this fish's response. ;)

Re: Question on game structure?

Posted: Fri Dec 31, 2010 1:01 pm
by N64vSNES
GyroVorbis wrote:
N64vSNES wrote:
GyroVorbis wrote:Ignore N64vSNES. That's a terrible idea, a shitty design, and it should be avoided at all costs.
N64vSNES wrote:However most Object Oriented obsessed programmers say this is bad design so you could instead use a similar method with a AssetManager
What he meant to say was:
N64vSNES + More experience wrote:However most programmers who aren't complete dipshits and understand anything about good design or modularity of code would recommend any number of alternatives.
edit: Oh, and your example isn't even correct. If your (default) constructor is public, it isn't exactly a singleton now, is it?
First of all irrelevant of wether its a good design or a bad design I'm showing him ALL of the approaches he can take.
Excuse me? When somebody comes to these forums looking for help, I would like to at least have enough faith in humanity to believe that we would like to introduce a good solution to them. There are a million and a half shitty ways to do something in the programming world. People ask for help to find the good solutions.
N64vsSNES wrote:Third, you can't tell me your so fucking low that your going to get cocky of a simple error that I forgot the contructor? Thats like forgetting a semicolon, its the most obviouse error you can make but everyone makes it. So stop being a whiney bitch and learn that the is multiple ways you can approach a task.
And YOU can't tell me that you're so naive as to think that this was small mistake. You just defended singletons for three pages in the previous thread on the sole basis of "single object instantiation" then forget to make your constructor private? That is an aggregious mistake that completely alters the design you are presenting--not a trivial syntax error. That is not something that would have been intuitive for somebody who has never been introduced to the design to correct.
N64vSNES wrote:There you're saying exactly the same as Gyro, WHERE THE FUCK DID I SAY IT WAS A GOOD IDEA TO USE SINGLETONS?!?!
Ooooh, I don't know, maybe in the singleton topic where you literally spent three posts calling anybody who proved the design was shit object-oriented whores and refused to accept that there was anything wrong with the design?
N64vSNES wrote:I'll admit you and Gyro are some of the more experianced programmers on this forums but that dosen't mean you can say "Don't do this because its a bad idea" How about stating why thats a bad idea? Otherwise the noobs will be saying "Yeah singletons are bad because............."
Try because we just had another GIGANTIC topic on the matter (that you linked to) where YOU literally refused to accept anybody's input (until at least 3 pages in, but apparently that didn't stick with you at all).
N64vSNES wrote:Don't say I didn't point out the alternatives because the is a goddamn link to a thread ABOUT SINGLETONS. I'm not going to be a complete asshole saying "This is your only option because the rest suck" I'm going to show people ALL of the options irrelevant of which is better.
Do you realize how absolutely retarded your first sentence is? You pointed out alternatives to the singleton pattern by posting a link to a thread about singleton patterns. Really, bro?

When you present the alternative in a manner that literally insults its supporters followed by a quick link, that is not exactly being "unbiased" and representing all points of view, is it?

Not to mention what the fuck was your "AssetManager" code? How is that ANY different than the incorrect singleton code you had posted previously?

The bottom line is that this guy comes, asks for honest advice, you give him the shittiest possible solution (presented in the shittiest possible manner (it wasn't even correct)), after we had just discussed WHY this was a shitty solution (in a separate 3+ page thread), AND THEN you have the audacity to post a(n) (once again incorrect) alternative and present it in a manner that literally insults everybody who uses it? Where is the integrity in that?
avansc wrote:Dude don't sweat it to much, this is a case of two big fish in a very very small pond.
You're not worth this fish's response. ;)
Falco stop being a whiney cock sucking asshole.

Not once did I say singleton were a "good idea" I simply asked why they weren't.

It went on for three pages because you decided to fill your posts insulting them rather than stating why they shouldn't be used.

Either grow the fuck up or stop bitching about a design pattern that you yourself had supported in your engine for over a year ( at least ).

Re: Question on game structure? [Flame War]

Posted: Fri Dec 31, 2010 3:12 pm
by dandymcgee
Thanks for your input N64vSNES. :lock:

Just a word of warning, if your personal attacks on GyroVorbis or Arce continue I will not hesitate to enforce any consequences I deem necessary.

GyroVorbis and Arce, please let this one go to its grave. This is his final warning.