The problem is:
- There is a lot of repetitive wiring to be done
- In our situation, where all client-server interactions follow the same pattern, one interaction could safely be deduced from a minimum of information.
I think that Cairngorm should have a drink from RoR's "convention over configuration" cool-aid. How could this work?
Suppose you fire the event
new CairngormEvent("list_users", [rest params])
You do not have to define this event type. By convention, the controller will execute the ListUsersCommand. This ListUsersCommand is the piece you actually have to implement. Within ListUserCommand's execute method you call the delegate as usual. But, you should not have to define, what the delegate is supposed to do. Something like
should suffice. The delegate knows that the method "listUsers" translates into "/list/users" and dispatches the request onto its default server. The parameters are mapped onto CGI-style parameters, potentially converting camel-case into underscore_case. The response will automatically be sent to the command.
Of course, one should be able to overwrite, i.e. explicitly define the default behavior. But that can be done already.
Maybe, I am biased because in our project all client-server interaction is rather uniform, but I can well imagine that others go through the same kind of repetitive exercise. IMO this would be a worthwhile update to Cairngorm.