On Dec 6, 2006, at 5:52 PM, [EMAIL PROTECTED] wrote:
On Dec 06, 2006, at 22:47 UTC, Bob Jackman wrote:
Is a stub and an abstract method the same thing in RB? If not, how
does
one create an abstract method?
They're pretty much the same thing. Some people might use "stub" to
describe a method with a simple implementation and "abstract" to
describe one with no implementation at all. Others might reserve
"abstract method" to describe a method of an Interface. Potato,
potato... Whatever you call it, the key idea here is that Foo must be
defined in class A, even if it doesn't actually have any code in it at
that level.
Worth pointing out here that REALbasic has a superior mechanism: the
Event Handler. Define a method in the superclass, and call an Event
(that you define) in there. It makes the relationship between
superclass and subclass quite explicit (particularly absent an
Abstract declaration on methods), and places the superclass in charge
of the relationship rather than the subclass. Putting the (single)
superclass in charge of the relationship rather than the (potentially
many) subclasses is superior, briefly, because you're more likely to
be able to make changes in shared behavior that aren't confounded by
the when and how the subclasses override the superclass, or when (if)
the subclasses call back to the original or other superclass support
methods.
There have been numerous discussions about this on the NUG, going
back to posts by Andrew Barry (the original designer of REALbasic and
the originator of the Events paradigm) in the mid 90s, so I won't go
on at great length here.
But it deserves to be said: Events are unique to REALbasic. So if
you're reading advice about Object Oriented Programming, it won't
mention Events. Also, the REALbasic documentation is likely to lead
you to believe that Events are just for controls to propagate user
interface actions. Not so: Events are a general-purpose extension
mechanism, and except in some unusual cases, are simply superior to
method overriding.
Regards,
Guyren G Howe
Relevant Logic LLC
guyren-at-relevantlogic.com ~ http://relevantlogic.com
REALbasic, PHP, Ruby/Rails, Python programming
PostgreSQL, MySQL database design and consulting
Technical writing and training
_______________________________________________
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>