Re: Software Architecture/Design

Tom Plunket <[email protected]>
Newsgroups gmane.games.devel.sweng
Message-ID <[email protected]>
> Tom Plunket wrote:
>>
>> Anyway- this is a very strange discussion to me, having been steeped
>> in writing OO code in C, since obviously "the data knows nothing" and
>> all of the transformations were functions that took an "object" and
>> did some operation with it.

Alex Lindsay wrote:
>
> It seems to me that at least part of this discussion, and in particular, the
> performance benefits, come from not writing functions that take an object
> and do an operation, but writing a function that takes a pile of objects and
> performing the same operation on all of them.

Yes, I think that is the case.

> If that means warping these ideas to fit the mindset of a 'traditional OO
> C++ programmer' i.e. someone who writes classes representing single objects,
> then maybe we should be telling them "hey, instead of making 'class Car',
> make 'class Cars' and keep all cars in there. Write member functions that
> act on all the internal cars and maybe return new instances of Cars." to
> shove them in the right direction, a direction currently dictated by slow
> memory and multiple CPU opportunities.

The amazing thing to me is how similar ideas lead to such vastly
different implementations across programmers.  My bent would be to
avoid creating a class Cars, and instead just have a Car array; that
way I /could/ access an individual item if/when I wanted or needed to,
but by default process the array in one go (for things like the update
function).

-tom!

--
_______________________________________________
Sweng-Gamedev mailing list
[email protected]
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.