Fwd: eliminate EXTENSIBLE types?

From: Fyodor Tkachov <"Fyodor>
Date: Mon, 04 Oct 2004 14:19:47 +0400

----boundary-LibPST-iamunique-1853224215_-_-
Content-type: text/plain

----- Original von: Fyodor Tkachov <fyodor.tkachov{([at]})nowhere.xy

>> > Any (normal) procedure may be
>> activated by any"one", a method only by the owner, i. e. an object of

>>the correct type.
>
>There is no practical difference between o.Init and Module.Init( o ) >because in order to perform the latter call one still has to have an object >(o) of the correct type.
>The only difference is the explicit appearance of Module in the second >case, which I maintain only adds to clarity of the code.

May I disagree? Just imagine you have a binary tree with graphical objects, which are alle descendants of an object of Type "GraphicalObject.Object". Now, for any reason, you want to initialize a node. Using Module.Init(o), you have to know (that means checking!!) what object it is. By using its underlying Init, you need not know anything detailed about the object. Not only that you would have to CHECK every object, it would also be necessary to add all descendant modules to your code that handles general object operation. So, either you could not do those general operations where they belong (in Module GraphicalObject), or you whould have to include all descendant objects into the same basic module (which is quite bad to work with).

>> Of course you can avoid OOP alltogether and the code may even be
>>more effective.

>> But I believe encapsulation to be quite useful.
>
>All this has nothing to do with encapsulation.

I think it has, see the above.

>Coming back to your chain of three types A, B, C, inheriting from each >other, A and B being ABSTRACT, and C being LIMITED, all defined (as >you proposed) in separate modules (call them ModuleA, ModuleB and >ModuleC).
>Suppose instead of (extensible) methods like (a: A) Init() one has >procedures like ModuleA.Init( a: A ), etc.
>ModuleB.Init( b: B ) only has to make a proper call to ModuleA.Init -- >and C does not need to know how B is implemented -- how it calls >ModuleA.Init, etc.
>A perfect encapsulation, so far as I can see.

See above.

>If one inherites from the type B, one knows which module the type B is >defined in (ModuleB), and one automatically has access to procedures in >ModuleB.

Definitely wrong. The key to OOP is, that there are circumstances, where I do not know (and do not NEED to know) what kind of object there is EXACTLY, and where it is sufficient to know the base type.

>So writing b.Init instead of ModuleB.Init( b ) hides exactly nothing, and >only saves typing the module name.

Nah!

>Supercalls are completely superfluous and are replaced by calls to >ordinary procedures.
>To reiterate: a type one inherits from always belongs to some known >module, therefore one has access to the procedures in that module,
>including whatever initialization procedures one might need for hidden
>fields.

This assumption is plainly wrong.

N. Wirth, in a very recent publication, says: "Whereas in strongly types languages, such as Algol, Pascal, and Modula, every constant, variable, or function has a fixed type, recognizable from the program text, Oberon allows to define hierarchies of types, and to determine the actual type of a variable (within the hierarchy) at run-time. This, together with records containing fields of procedural types, is the stem of object-oriented programming. Such records are then called objects, and the procedural fields are called methods." (
http://www.oberon.ethz.ch/wirthPiO/Preface.doc).

Now, I know that Wirth is not the Bible, nor is he Marx, but it is a fact that the key feature of OOP is *not* needing to know the exact type of an object at runtime. It is enough to know a BaseType and let the object itself handle how it actually behaves. If you don't need that feature, you don't need Oberon. Use Modula-2.

Rene
Rene



-------------------------------------------
Versendet durch AonWebmail (webmail.aon.at)

Powered by the E-mail PIM - Info Select - www.miclog.com
--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy

Current posting policy:

a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.

b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.


----boundary-LibPST-iamunique-1853224215_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnR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ccGFyDQpccGFyDQpD
dXJyZW50IHBvc3RpbmcgcG9saWN5OlxwYXINClxwYXINCmEpIFRvIHBvc3QgeW91IHNob3VsZCB1
c2UgdGhlIHNhbWUgYWRkcmVzcyBieSB3aGljaCB5b3UgYXJlIHN1YnNjcmliZWQgdG8gdGhlIG1h
aWxpbmcgbGlzdC4gVGhhdCB3YXksIHRoZSBsaXN0IHNlcnZlciB3aWxsIHJlY29nbml6ZSB5b3Ug
YXMgc3Vic2NyaWJlciBhbmQgZm9yd2FyZCB5b3VyIHBvc3RpbmcgaW1tZWRpYXRlbHksIHdpdGhv
dXQgY3JlYXRpbmcgYW55IG92ZXJoZWFkLlxwYXINClxwYXINCmIpIElmLCBmb3Igc29tZSByZWFz
b24sIHlvdSBjYW5ub3QgcG9zdCBmcm9tIHRoZSBhZGRyZXNzLCBieSB3aGljaCB5b3UgYXJlIHN1
YnNjcmliZWQsIHlvdXIgbWVzc2FnZSB3aWxsIGJlIG1vZGVyYXRlZCB0byBhdm9pZCBzcGFtLiBQ
bGVhc2UgdW5kZXJzdGFuZCB0aGF0IG1vZGVyYXRpb24gd2lsbCBvZnRlbiBjYXVzZSBzb21lIGRl
bGF5LCBpbiBwYXJ0aWN1bGFyIG92ZXIgd2Vla2VuZHMgb3IgaG9seWRheXN9fQBpbmhlcg=


----boundary-LibPST-iamunique-1853224215_-_---
Received on Mon Oct 04 2004 - 12:19:47 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:28:34 UTC