How object oriented are you?

Moderator
Posts: 3,574
Joined: 2003.06
Post: #16
JustinFic Wrote:I'd have to disagree here- having a whole class hierarchy to tie into means I can experiment with things very quickly, with very little wasted code.

I think what he's trying to get at is that if you don't fundamentally understand how it's all going to tie together in the end, OO can really slow you down. I agree with that from the standpoint that you do have to have a standard overall "system" (for lack of a better term) for how you put your games together. If you don't have that, then it's hard to know what classes need to be designed in the first place.

OTOH, as you pointed out, OOP is really supposed to help alleviate that problem, not create it. I've had it happen both ways for me:
- Start a project and spend so much time re-designing the class network that I could've just done it procedurally in the first place and been done with it. Bad experience with OOP, didn't really want to do that again.
- Start a project on a whim and it just falls together like the code wrote itself. Great experience with OOP, I'm now a hardcore OOP convert and will never criticize it again because that would be like swearing in church.

But, those have both happened to me with C too, so that means that it's the design, not the language. i.e. it really comes down to the programmer's skill (in my case, the lack of it)
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #17
Object-oriented where it makes sense, procedural where it makes sense, and functional where it makes sense. So, all of the above for me.
Quote this message in a reply
Hog
Member
Posts: 151
Joined: 2002.09
Post: #18
Skorche Wrote:Some languages make statements like object.x = value into a method call implicitly.

in C++ you can just aswell: simply overload assignment and cast operators and wrap if necessary.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #19
Hog Wrote:in C++ you can just aswell: simply overload assignment and cast operators and wrap if necessary.
Unfortunately that doesn't quite cut it. You essentially want it to be syntax sugar for object.setX(x). You could have a special container object for x that calls a function on object to set the value, but that will add quite a bit of overhead to each member and be quite annoying to set up.
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #20
akb825 Wrote:Unfortunately that doesn't quite cut it. You essentially want it to be syntax sugar for object.setX(x). You could have a special container object for x that calls a function on object to set the value, but that will add quite a bit of overhead to each member and be quite annoying to set up.

I read an article about how to do exactly that using templated wrapper objects that act just like the wrapped data type. It simply didn't seem worth the effort...
Quote this message in a reply
Hog
Member
Posts: 151
Joined: 2002.09
Post: #21
akb825 Wrote:..., but that will add quite a bit of overhead to each member and be quite annoying to set up.

not to each member, only the ones that need to have a special update method added. I personally though prefer to have most of my member variables protected and go without any getters or setters at all unless it's some sort of primitive storage struct that needs no protection.
Quote this message in a reply
Post Reply