I think the bigger question is, what happens in the future when we decide we need to make changes to the ActionContext interface? I don't have an answer right now, but I felt like I needed to ask the question.
I think this is one of the reasons Craig often cites when asked about the use of superclasses instead of interfaces. I certainly appreciate the flexibility of making ActionContext an interface, but the cost is we either lock the API or cause possible compatibility problems when changes need to be made.
Perhaps, although I think it's more about preventing people from implementing interfaces on classes which really do something else. In any case, the common approach in many APIs is to strongly encourage people to implement ActionContext by extending ActionContextBase, and maybe that's reason enough.
Hmm... what about separating the logic from the data? We keep ActionContext close to the Context concept, mostly limited to accessors to data, then we have an ActionContextUtil which contains common operations on ActionContext objects. Methods such as addMessages(), getMessageResources(key), and *Token() can be placed there. There's still the chance of compatibility problems when there's an API change on ActionContext, but this could minimize it.
Yeah, I thought about this, and it's just a design style I find distasteful. Not horribly so, but not what I'd choose first. Still, it's perhaps true that it better separates conveniences from the core responsibility of the class.
Or you could go to the other extreme where the ActionContext disappears and we stick to plain Context, then let ActionContextUtil contain all the Struts-specific operations such as extracting data from the map and casting them to the right class:
return context.getMapping().findForward("success"); vs. return contextUtil.getMapping(context).findForward("success");
I suppose, but personally I don't like this one much more.
Thanks for weighing in, Hubert -- looking forward to hearing some other opinions...
Joe
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]