Question
Make ICommand a marker interface to avoid cast of event in command
I'd like to remove the execute method from ICommand.
Pro: We can declare the execute method with the concrete event class. No need to upcast the CairngormEvent inside execute.
//currently
public void execute( event : CairngormEvent ) : void
{
var concreteEvent : ConcreteEvent = event as ConcreteEvent;
}
//with ICommand being a marker interface
public void execute( event : ConcreteEvent ) : void
{
//no need for a cast here
}
Contra: We loose the compile time check for the execute method being implemented.
Thoughts?
Pro: We can declare the execute method with the concrete event class. No need to upcast the CairngormEvent inside execute.
//currently
public void execute( event : CairngormEvent ) : void
{
var concreteEvent : ConcreteEvent = event as ConcreteEvent;
}
//with ICommand being a marker interface
public void execute( event : ConcreteEvent ) : void
{
//no need for a cast here
}
Contra: We loose the compile time check for the execute method being implemented.
Thoughts?
