http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why Does Everyone Insist On Using Structs for Everything?!



I don't know...to me not OOP is like taking a model airplane out of the box
and instead of assembling it, I just dump the parts on my shelf and call it
a model.  Or an even better anology....

Let's say you have a car.  Okay let's look at how we would work the car in
an object oriented world, and a top down world.  In OOP Land, the car would
have all of it's parts inside and everything is intertwined and connected.
And to work the car all we have to do is :

/*Granted this is not actual code, it's just an example*/

car.getIn( Person *person );
car.ignition.fire( Key key );
car.gasPedal.push( );

And then the car reads the input (gas pedal) and off it goes!

Now...in Top Down Land.  We have a little man in the mist of a bunch of
unorganized parts.  Now with this implementation, probably only the person
who made them could work them.  But let's say this man gets it working.  He
doesn't get in the car, but he sorts through the parts, finds the ignition
and puts in the key, which is in no way connected to the rest of the car.
So he has to hold the wire to the spark plugs, PASSING the argument of the
electricity to the spark plug, and if he screws up, he gets shocked.  In OOP
land, we don't need to help the car along, it just works!  In both examples,
the code created is the same, but with the data encapsulation, any other
user of the code is less bound to screw up.  And it makes programming a lot
simpler.

Sorry for this rant.  I just like to make my point.  And YES structs are OOP
in a way.  But a mixture of them and classes is best.  But I'm not trying to
be OOP Land Gestopo, I'm just arguing my case.  This could cause a massive
thread!  *Dr. Evil Laugh*


Sincerely,
                                                                        Mike
Main

> << 't anyone ever use C++ for what it's good for?  Object oriented
>  programming?  Everyone always seem to use structs.  Giving everything
acess
>  to encaspulated members makes me want to scream!  AAAAARRRGGGGHHH!!!!
Sorry
>  for the rant I had to get that off my chest :). >>
> In MSVC, I can't use C++ routines with a C lib, so I use all structs and
no
> classes.
> -they're just fun to organize global variables with, too! (=
> =================================================================
> The GameProgrammer.Com mailing list is for the open discussion
> of any topic related to the art, science, and business of
> programming games. This list is especially tolerant of beginners.
> We were all beginners once
>
> To SUBSCRIBE or UNSUBSCRIBE please visit:
> http://gameprogrammer.com/mailinglist.html
>

=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html