> Take a look at the "Reclaiming Type Safety" section in this 
> article on the 
> 
> event notification pattern here:
> 
> 
> 
> http://members.ispwest.com/jeffhartkopf/notifier/
> 
Cool, that's a neat way of achieving type safety.  Avoiding downcasts (eg.
Object to byte[]) is a good thing.  It still relies on a runtime check but
is only performed in one piece of code instead of every implementation of an
event receiver.

Advantages:
Type safety enforced in a single class instead of using downcasts within
each event receiver.
Single event method defined in interfaces instead of methods per event type.
No need to define separate interfaces per event type.

Disadvantages:
No compile time type checking, incorrect types may not be picked up during
development.
Runtime overhead to perform reflection on event receiver class and locate
type specific event receiver method.
Runtime overhead converting from generic event type to specific event type.

I don't know if compile time or runtime checks should be used but if runtime
checks are chosen then this pattern is a good way of enforcing them.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to