--
You received this message because you are subscribed to the Google Groups "Richmond Software Craftsmanship Group" group.
To post to this group, send email to RS...@googlegroups.com.
To unsubscribe from this group, send email to RSCG+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/RSCG?hl=en.
Out of curiosity, why use an interface if it has only one method? Why not System.Action?
Now, if there were also an Undo() method or something, an interface would start to make sense to me...
- Jon
I'm not sure I buy that; an Action could refer to any instance method taking no parameters, so this would be entirely valid:
Action command = new WhateverType (constructorArgs) {
Property1 = Value1, /* ... */
}.Execute;
OK, it would probably be better to split that up: ;-)
var c = new WhateverType (constructorArgs) {
Property1 = Value1, /* ... */
};
Action command = c.Execute;
Either way, we have an object that contains all the state you want. You're just using an Action to refer to the command instead of some concrete interface. I don't see a huge difference either way, and I find delegates more easily composable than interfaces.
> On top of all that, using an interface helps create a "seam" for testing.
I'm not entirely sure what "seam" testing is, but I don't see why delegates would make this any harder.
- Jon
I don't buy this either; passing an Action across an AppDomain boundary will still result in serializing the referenced class instance and loading the containing assembly into the new AppDomain. It's not any different than passing an instance across an AppDomain boundary, as you still are passing the instance across the boundary.
- Jon