On 09/01/2007, at 3:23 PM, Robert Livingston wrote:

Extraordinary.

Dennis teaches me that my thinking about an instance and a class is somehow muddled.
...

The word "casting" only rung a distant bell when mentioned by Jack. So I went to read about it in the User's Guide and get a vague understanding of what it is. I have a hard time understanding that the window I am designing (and putting things like StaticText1 inside) is an object class rather than an instance of a window, but perhaps someday it will be second nature for me to understand completely the difference between an instance and a class.

As a long-time OO developer and user of many other frameworks, I didn't have any trouble understanding this stuff, ONCE I REALISED WHAT WAS HAPPENING.

In what I think is a misguided attempt to simplify things for beginners, the RS documentation doesn't explain Windows (and Container Controls) in terms of subclasses.

I haven't read the rest of the thread but one way to look at it is this:
- instances of things are used when you have the same behaviour (in your methods) and need to independently track state (properties) - subclasses are used when you need to either vary parent behaviour (overriding methods) or add new behaviour or ways to track state.

In the context of most other OO frameworks:
Most other OO frameworks separate out some kind of graphical window editor from the code.

Windows in those frameworks which do NOT have any methods are often implemented without subclassing - they just have a list of controls attached. eg: if you just popped up a simple alert.

  When you need to add logic in the window, you subclass.

REALbasic takes away the need to make the subclassing decision - ALL windows are subclassed for you, automatically.

They further complicate things by explaining stuff very badly about how instances of controls work on windows and the role of the code in the Event handlers for those controls. The User Guide (p 455) is WRONG - it says "when you add control such as a Pushbutton to a window and then add code to that control, you are really adding code to one instance of the PushButton class"

The code in PushButton1.Action is being added to the Window1, as a method.

That means, and can be proved, if you have protected methods and properties within the Window, code in PushButton1.Action can directly access them, just like code in any other method of Window1.

So, if you have struggled, it isn't your fault.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to