On Mar 9, 2006, at 9:07 PM, Andy Dent wrote:
On 10/03/2006, at 4:19 AM, Guyren Howe wrote:
But for those keeping score at home: no-one has offered an example of
class extension, other than the couple of corner cases I cited, where
the results are clearer/easier to write/easier to maintain/anything
else convincing, using method overriding rather than Events.
Maybe I missed it - did someone offer such an example proving Events
are better?
Yes, I'm seriously interested (I too am always trying to increase my
education).
So for now, my assertion stands: Events are just better. You should
use Events basically for all your class extension.
So you shouldn't write code that can be
a) easily understood by someone who also works in other OO languages
b) copied to other OO languages?
Maybe most professional RB programmers are sufficiently wedded to RB
to not consider this an issue.
I would have to see some very good reasons for why Events are better,
to abandon the flexibility of using virtual methods (outside of their
use in Windows and controls, where they are satisfying a different
pattern).
Such reasons have been posted over and over, written about in RBD, etc.
In short, events help to avoid fragile base class problems. To offer
one example, suppose that in every REALbasic framework class having a
constructor, an Open event was added. Then we'd never need to guess
whether we should call the superclass constructor when overriding it.
But they aren't the best device for all situations, because there is no
best device for all situations. Just to annoy Guyren, I claim that the
need to check whether an event is implemented or not is a sign that
perhaps one is better off using overriding.
--------------
Charles Yeomans
_______________________________________________
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>