Re: Consuming your own events.

Peter Ritchie <[email protected]> Thu, 31 Jan 2008 12:44:21 -0500
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <LISTSERV%[email protected]>
On Thu, 31 Jan 2008 17:19:12 +0000, Sebastien Lambla <[email protected]>
wrote:

>Just like we moved away from unmanaged to managed, and to IoC (after all,
>the new keyword works well enough, doesn't it?), leaving On and adopting
>Raise / Handle seems justifiable. I find the argument of adoption to be
>accurate but limiting.

"new" isn't good enough in most IoC situations.  You use IoC to decouple
implementation, no correct usage of "new" would allow you to do that.

You can still correctly implement OnXXX...  If you find that your
developers have a problem with the OnXXX pattern (i.e. they don't know
enough that its intention is to raise an event) then you have more serious
issues...

http://msdn2.microsoft.com/en-us/library/wkzf914z.aspx seems pretty clear
to me.

Adding a RaiseXXX pattern is fairly benign and does make it more clear
(without reading documentation) but offers no more guarantees that
developers will use it more correctly than OnXXX.  It does introduces yet-
another-way the programmer has to do something.  If they're doing a lot of
Form programming and must deal with the OnXXX pattern, a RaiseXXX pattern
could be viewed as just adding friction.

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com