Ok, so its been nearly a month since I last posted. I have been in a royal funk lately.
So there had been some interest in the whole Sequence Command thing awhile back. And I had never really followed through. So now that I have some free time, I am reviving the initiative. If you like, you can get a refresher (part a, part b). But today’s post is going to be more of a request for input from fellow developers. So let’s get started.
So the issue currently is this: I am wanting to enforce a contract for those who plan to use this ‘framework’ (for lack of a better word). Contract immediately sparks to mind the term interface. But I feel that an interface is too loose, too democratic, too free. Specifically I want the developer to make sure to dispatch the following events on their respective triggers:
- CommandBaseEvent.EXECUTE
- CommandBaseEvent.FAULT
- CommandBaseEvent.RESULT
If I were to make the CommandBase class an interface (ICommandBase?) then I would have to rely on developers to make sure to dispatch those events themselves. If I were to go the inheritance route, I would still have to rely on developers to make sure to call the super’s methods that are getting overridden. So I am a bit stuck and having an OCD moment here. What to do? Should I:
- use an interface
- use inheritence
- use an interface that require dispatchEventMethods such as dispatchExecuteEvent, dispatchFaultEvent, dispatchResultEvent
I would love some input from the community.
