Re: Software Architecture/Design
Richard Fabian <[email protected]>
| Newsgroups | gmane.games.devel.sweng |
|---|---|
| Message-ID | <[email protected]> |
On 9 June 2010 00:20, Tom Plunket <[email protected]> wrote: > Richard Fabian wrote: > > In OO, if part A calls in part B, it can happen like this: > > partA->Tick() > > { > > /*body*/ > > if( this->SomeCondition() ) > > this->GetEntity()->GetComponentB()->DoSomething(); > > } > > Oh come now, you can't give an example of code which any respectable > OO developer would call "not OO" and say that OO should be replaced by > something else. I mean seriously, I understand the desire to replace > "poor design" with "good design," but you could just as easily replace > the above with a "better" OO design and reap the benefits that folks > seem to be attributing to DCI. > In a way you've got the point of the argument. Any respectable developer wouldn't call that OO. But, that's the dog food we have to live with when people start putting components in objects. So why would we not try to discourage it? Veteran OO coders would solve it with messaging (which has it's own pitfalls), or having the owner of the components manage the transform that required the components to have some communication (heading towards DCI), or better still, find some way that the communication wasn't necessary (OO). The problem with all these correct approaches is that it's more code to write. More code to write is more dangerous for a project, so hacks creep in and then it becomes standard practice. More often than not, code written stays written and this is the kind of code that gets the job done while hurting others. It's not OOs fault that C++ lends itself to making messes of stuff, but again, it does seem to be C++ that causes OO coders to write "elegant to a point" code. Projects all start out written well, but soon enough the profit fairy comes along and tramples on your schedule and suddenly a couple of hundred hacks become "necessary". My gripe is not with OO, it's with the monster that we have to use daily that pretends to be OO in C++. -- fabs(); Just because the world is full of people that think just like you, doesn't mean the other ones can't be right. _______________________________________________ Sweng-Gamedev mailing list [email protected] http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com