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 13 of 14 Topic 954 of 1011
Post > Topic >>

Re: Advantages of OOP

by <ear@[EMAIL PROTECTED] > (Matti Kujala) Nov 14, 2007 at 11:32 AM

Anton <anton.txt@[EMAIL PROTECTED]
> writes:

>Miss Elaine Eos:

>> * Inheritance allows one to design hierarchies of "things" (objects) 
>> that share common functionality and to share the code that is common 
>> among them.  The shared code allows bug fixes, enhancements, 
>> modifications, debugging, etc., across an entire range of related
>> things. 

>Well, this is a very general principle of... how to call it?.. unicity: 
>same actions should be expressed by the same code. A simpler example is 
>declaring a constant instead of hard-coding some number in several places

>in the code. It's kinda forcing integrity, a guarantee you won't screw 
>things up by changing this value...

>I think, PP-programms should also be designed with this principle in
mind. 
>Howeever, instead of object hierarchy, PP offers Unit/Procedure hierarchy

>-- a different means for the same thing. And now I am interested in which

>cases the OOP's approach to unicity exceeds that of PP. There should be 
>cases when with OOP it's much easier to maintain unicity.

As I see it, OO is all about following certain design and coding
ideologies, this 
"unicity" being one of them. While good programmers can do all these
things without 
OO features in language, OO language encourages and enforces them.
Hopefully 
this makes it easier for not-so-good programmers to make a bit better
code. OO 
features make some things like dynamic binding much easier and probably
less error 
prone (thinking C++ here).

>> Note that you can do OOP in PP, without any language helpfulness.

>That's interesting! Is there a way to "emulate" simple incapsulation? If
I 
>define a function and a data structure, and even put a pointer to the 
>former into the latter, I will still have to pass the record to my 
>function. Otherwise it'll not be able to access its objects's
properties... 
>The call would look rather redundant: Obj.Function(Obj,<other
parameters>);

I would say difference between FuntionToCall(MyDataObject) and 
MyDataObject.FunctionToCall() is very small. Nice syntactic sugar, but
only that. 
However, constructors and destructors are nice sometimes.

>Plus OOP-like data hiding -- no idea how to implement it.

Well, you can have your datastructures behind void pointers, but that's
quite a 
dirty hack to enforce hiding. Ofcourse you'll also lose all typesafety.

>> * Data hiding helps one avoid the pitfalls associated with changing a 
>> value directly when said value change is linked to other values. 
>> Again, this can be done in PP, but is prone to error, if someone
>> forgets to change all the appropriate related info, setting a variable
>> without using its "setter."

>Well, PP has it's own Data Hiding. Units' INTERFACE and IMLEMENTATION 
>sections, nested procedures and functions, restricted types, detailed 
>control over ex****t (MODULA-like),... It's just different from OOP.

Not all PP-languages have these features. Someone might argue that these
are OO 
features. I don't think there is a strict line between OO languages and PP

languages, nor I think there's a need for one. 

-- 
What sorcery, what spells, have brought thee here?
 




 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:05:17 CDT 2008.