Is nothing in OOP obvious to the neophyte?
Here is comment from a class named Observable declared as follows :
public abstract shared Observable
The documentation for the class contains the following method comment :
public add-observer
Add an observer to this object's list of observers to be notified. Typically this is only called from the Observer's observe method.
For this to make sense to a neophyte, wouldn't we need TWO variants of PUBLIC, e.g.,
- MY-PUBLIC-FACE
- YOUR-PUBLIC-VIEW-OF-ME
corresponding to
- obj-public (intended for me to call against myself)
- consumers-public (available as your message sent to me)
??
BTW, that add-observer method is declared as follows :
public
{Observable.add-observer
o:Observer,
error-if-present?:bool = false
}:void
Is the issue the method name ? Should it be
all-ya-all-add-observer-to-me
??
Consider :
receive-observer
But what in a name prevents a hack ? One idea : object procedures and functions versus messages. In such a language, an object never sends itself a message. If you have a local copy of an object, you can use its public procedures and functions. If you have a pointer to an object - an object reference - you send only messages.
And what did the documenting author mean by "typically" ?
No comments:
Post a Comment