I have some new habits.

Started by
79 comments, last by Tutorial Doctor 10 years ago
You don't sound harsh spinning cube. I could stay away from OOP, I just thought it would be a neater way to organize the code. I could see how messy it could get.

I won't finalize the setup of the code until I have a design that makes sense. In fact, I will be using dofile() to access the functions, so I want using the functions to be simple. I will add comments to the main script file to instruct editors on how to use the functions.

In the script all I have to do is type
Collect(object_name)
And any object can be collected. I could easily specify the amount of points to give if a certain object is collected by adding one additional parameter.

Collect(object_name,points_earned)

They call me the Tutorial Doctor.

Advertisement

Spinning Cube is entitled to his/her opinion of course, but a blanket statement "OOP is bad" isn't something I'd suggest you worry about. There are certain issues we have gradually discovered with OOP over the years, mainly related to deep inheritance hierachies, but I don't think many people consider encapsulation and grouping of data with actions upon the data to be a bad thing.

The recent shift towards data-oriented programming has more to do with best exploiting the way hardware works than making design easier, and the current hysteria about entity-component systems is a little young to be considered a panacea.

Since it falls on some deaf ears.

http://www.insomniacgames.com/three-big-lies-typical-design-failures-in-game-programming-gdc10/

https://d3cw3dd2w32x2b.cloudfront.net/wp-content/uploads/2011/06/threebiglies2010.pdf

Short version:

(Lie #1) Software is a platform
I blame the universities for this one. Academics like to remove as many variables from a problem as possible and try to solve things under "ideal" or completely general conditions. It's like old physicist jokes that go "We have made several simplifying assumptions... first, let each horse be a perfect rolling sphere..."
The reality is software is not a platform. You can't idealize the hardware. And the constants in the "Big-O notation" that are so often ignored, are often the parts that actually matter in reality (for example, memory performance.) You can't judge code in a vacuum. Hardware impacts data design. Data design impacts code choices. If you forget that, you have something that might work, but you aren't going to know if it's going to work well on the platform you're working with, with the data you actually have.
(Lie #2) Code should be designed around a model of the world
There is no value in code being some kind of model or map of an imaginary world. I don't know why this one is so compelling for some programmers, but it is extremely popular. If there's a rocket in the game, rest assured that there is a "Rocket" class (Assuming the code is C++) which contains data for exactly one rocket and does rockety stuff. With no regard at all for what data tranformation is really being done, or for the layout of the data. Or for that matter, without the basic understanding that where there's one thing, there's probably more than one.
Though there are a lot of performance penalties for this kind of design, the most significant one is that it doesn't scale. At all. One hundred rockets costs one hundred times as much as one rocket. And it's extremely likely it costs even more than that! Even to a non-programmer, that shouldn't make any sense. Economy of scale. If you have more of something, it should get cheaper, not more expensive. And the way to do that is to design the data properly and group things by similar transformations.
(Lie #3) Code is more important than data
This is the biggest lie of all. Programmers have spent untold billions of man-years writing about code, how to write it faster, better, prettier, etc. and at the end of the day, it's not that significant. Code is ephimiral and has no real intrinsic value. The algorithms certainly do, sure. But the code itself isn't worth all this time (and shelf space! - have you seen how many books there are on UML diagrams?). The code, the performance and the features hinge on one thing - the data. Bad data equals slow and crappy application. Writing a good engine means first and formost, understanding the data.

Your opinion and a couple of weblinks notwithstanding, OOP is not "bad" and not "to be avoided" and this is terrible advice to be giving to a beginner.

...


Taking anything to the extreme will always get you into hell's kitchen. Thinking of OOP as something everything must use will. Thinking of OOP as something that must be avoided at all cost will too.

The hallmark of a good developer is not blind religious obedience of a few dogmas. Instead it's about finding and putting the correct pegs into the relevant holes (unfortunately real-life problems seldom boil down to "round vs square").

http://www.insomniacgames.com/three-big-lies-typical-design-failures-in-game-programming-gdc10/

Haha!

Oh it's refreshing how programmers react with their gut, religiously bashing what they cannot understand or have a blind spot to. Talk to any game (or non-game) programming veteran and they will show you how

OOP design leads to zero core re-use (this is sold as the big thing but in fact more than often leads to code trashing)

Function based and data oriented is plug-and-play

OOP for simple data encapsulation is ok. (I never said I don't use structs or templates and other "naive" OOP concepts)

How thinking of objects and object-to-object interaction leads to more complex code while data transformations leads to less complex.

No this has nothing to do with entity-component which in my mind is also an OOP fallacy. Hah! Now I just upset two hornets nests...

If you actually read what I have in the link (will take maybe 40 min) you see it's from seasoned programmers from Insomniac games, with the best programmer working environment in the industry. Is that a coincidence? Maybe they actually think less stereotyped and more free about programming?

Meditate on that :-)

PS - why do I even bother...

PS2 - The reason I think OOP is used in programming is to increase code trashing, design cycles and increasing complexity such that more money can be demanded from clients. I think that was the original factor ;-)


PS - why do I even bother...

No idea. Perhaps you should give up?

I'm not a fan of over engineered OOP and I hate entity-component but you still sound like a zealot with a tinfoil hat to me.

http://www.insomniacgames.com/three-big-lies-typical-design-failures-in-game-programming-gdc10/

Maybe :-) I'm just too much of an idealist trying to wake people up by shaking up their beliefs.

I hope someone actually reads the link and takes home a betterment to their coding style and design thinking.

Cheers,

Spinningcube, you're not being downvoted because what you say is incorrect. You're being downvoted because you're being rude and extremist (relative/situation dependent truths are generally more true than extreme absolute truths).
I expect there'll be zero tolerance for flaming / flame bait from this point on in the thread.

(Though not from me if I decide to join the conversation :p)

Oh it's refreshing how programmers react with their gut, religiously bashing what they cannot understand or have a blind spot to.

its arguable that this is what you were doin on the first page ;-p

This topic is closed to new replies.

Advertisement