Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Gaming > Development Programming Misc > Re: Advantages ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 14 Topic 954 of 1011
Post > Topic >>

Re: Advantages of OOP

by Anton <anton.txt@[EMAIL PROTECTED] > Nov 3, 2007 at 12:26 AM

Serve Lau:

> Suppose you created a class that you know has been inherited from by
> other programmers. Suppose you want to change that class. You cant
> really oversee the consequences can you? Inheritance creates another
> kind of dependency in code and there are already so many dependencies
> in structured code.

Well, the same applies to changing a procedure/function that others use...

But looks like in OOP the interrelatons may be much deeper...

> and he was so impressed with OO
> that he just had to use 3 OO constructs on every line of code.

Yeah, rather scary situation!

> And seeing there's always at least one
> of those people on the projects I work on I kinda started disliking OO

Don't you think it's abuse of OO, not use of it?

Today I've had a little talk with my friend, a JAVA programmer, and he
told 
me about the state-of-the-art OO-style. Particularly, the so-called 
'Command' design pattern.

Imagine you have to write a message handler. Instead of implementing a 
single function with a case, and even using an array function pointers 
indexed by message ids (wich is faster), the recommendation is to imlement

a generic interface (abstract object) with only one method (let's call it 
execute()).

Thereafter, one has to implement a class (derived from that interface) for

_each_ of the messages! This having been done, the thing works in an 
utterly awkward (to me!) way: on receipt of a message, an object of the 
corresponding class (in JAVA you can refer to cl***** by their name to 
dynamically choose which class to create, not sure how to do it in C++ or 
Object Pascal...) is dynamically created and its execute() method called.

I asked him what all this mesh is for? If I was doing that, I'd just make
a 
single handler with a case (assuming that piece is not speed-critical)...

"That improves flexibility" — he said, — "Plus adding the handling for a 
new messege implies no _changes_, only _addition_ (of another class)"

Now I am wondering: is that really so im****tant to prefer adding new 
functions to changing the old ones (as simple as appending another case 
statement)?

Anton
 




 14 Posts in Topic:
Advantages of OOP
anton.txt@[EMAIL PROTECTE  2007-10-28 05:15:13 
Re: Advantages of OOP
Miss Elaine Eos <Misc@  2007-10-28 14:07:23 
Re: Advantages of OOP
Antonius <anton.txt@[E  2007-10-28 07:55:04 
Re: Advantages of OOP
Miss Elaine Eos <Misc@  2007-10-29 03:59:55 
Re: Advantages of OOP
"Serve Lau" <  2007-10-29 15:16:04 
Re: Advantages of OOP
Anton <anton.txt@[EMAI  2007-10-29 22:29:57 
Re: Advantages of OOP
"Serve Lau" <  2007-11-02 19:37:47 
Re: Advantages of OOP
"Serve Lau" <  2007-11-02 19:42:35 
Re: Advantages of OOP
Anton <anton.txt@[EMAI  2007-11-03 00:26:27 
Re: Advantages of OOP
"Serve Lau" <  2007-11-03 12:27:13 
Re: Advantages of OOP
Anton <anton.txt@[EMAI  2007-10-29 22:29:49 
Re: Advantages of OOP
Miss Elaine Eos <Misc@  2007-10-30 02:59:02 
Re: Advantages of OOP
<ear@[EMAIL PROTECTED]  2007-11-14 11:32:38 
Re: Advantages of OOP
Antonius <anton.txt@[E  2007-11-15 05:23:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:11:41 CDT 2008.