Valid points, but Baz definitely points to an itch that many have tied to scratch before.

I use PureMVC primarily now for my projects and the only time I need custom events is to talk from my view component to its Mediator. Most of the time I do not need custom events at all. From the Mediator on PureMVC uses Notifications (also called notes) which pass around a body that holds any type of object. Sure, I need to keep track of what I put into the note in order to cast it to the right type when I read it back out but I must say this system works very well. In fact I do not recall a single runtime error that was due to casting of note bodies.

Cheers

Stefan



On 17 Sep 2008, at 05:33, Doug McCune wrote:


I think mostly it's the worry that you'd end up with some code that assumes one kind of payload and end up with a payload that's a different type, at which point you'd get a runtime error, but the compiler never would have caught it. Using specific events with strongly typed payload data means that the compiler will check anytime you try to reference the wrong type of data from the wrong event. Just gives you that one extra warm fuzzy feeling about knowing you're not going to run into some nasty runtime error.

Doug

On Tue, Sep 16, 2008 at 9:29 PM, Josh McDonald <[EMAIL PROTECTED]> wrote:

Some of us are from Java, and we're type-safety-crazy =) But you can always use DynamicEvent!


On Wed, Sep 17, 2008 at 9:08 AM, Baz <[EMAIL PROTECTED]> wrote:

Whenever I make a custom event it is almost always only to store some sort of payload. For the past few applications I decided that rather than make a million custom events that pass around typed data, why not make a single generic PayloadEvent that can store any payload. It's been treating me well so far but I am a little concerned that I may be over-looking something that will bite me in the a**.

Am I?

Thanks for your opinions,
Baz



--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

http://flex.joshmcdonald.info/

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]




Reply via email to