Miss Elaine Eos:
> Is that the sort of thing you mean?
Not quite that, though thanks for this brief intro into OOP.
> * 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.
> 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>);
Plus OOP-like data hiding -- no idea how to implement it.
> You can also do PP in an OO language, ignoring the OO stuff.
Not in all languages, right?
> * 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.
Thanks for giving me a couple of interesting thoughts!


|