Hi,

Am 10.03.2006 3:59 Uhr schrieb " Andy Dent <[EMAIL PROTECTED]>"

>> 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?

Well, Guyren's case was, if I am not mistaken, that a chain of responsibilty
is very easy to break by mistake if you use methods.

> Yes, I'm seriously interested (I too am always trying to increase my
> education).

Consider this:

ClassA.SomeMethod
ClassBSubOfClassA.SomeMethod

Dim o as ClassA

o=new ClassBSubOfClassA
o.SomeMethod

Now, let's say at some point you realize that "SomeMethod" is a poor name
and you change it in ClassB but forget to make the according code changes.
The compiler won't complain, but you code will now, of course, call ClassA's
implementation of SomeMethod, which might not be what you intended.

Using events lifts the burden of having to think of making those code
changes from the developer. I think this is a very good reason to favor
events over method overriding.

>> 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).


- Maximilian Tyrtania | [EMAIL PROTECTED]
  fischerAppelt Kommunikation GmbH
  Tucholskystr.18 | D-10117 Berlin | Germany
  Tel. ++49-30-726146-728
  http://www.fischerappelt.de

--


_______________________________________________
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