ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  A Look at Commons Chain, Part 1
Subject:   Playing to Weakness
Date:   2005-03-03 07:43:53
From:   dakotajack


I think Bill Siggelkow hits the nail on the head in saying that the Template Method involves tight coupling and less flexibility and that this handicap is mitigated by Commons Chain allowing the algorithm to be defined through a configuration file interpreted at runtime. Indeed, if you have followed the attempt to use this "framework" as a substitute for the RequestProcessor of Struts v1.2.6 in Struts v1.3, you see how the limited this mitigation is.


Why in the world Commons Chain and Struts do not take advantage of the inherent benefits of the Strategy pattern instead of the Template Method pattern is a real mystery. Wouldn't the following be so much better it would just "pop out" as vastly inferior? I suggested this, but got no response with the open source (free) but closed community [a community that does not know the difference between a tickle and an itch -- ///;-)] building Struts:



public class DoSomething implements Command {
private Helper helper;


public void setHelper(Helper helper) {
this.helper = helper;


public boolean execute(Context context)
throws Exception {
// Have helper do stuff
return (false);
}
}


I would be interested what others think of this alternative.



1 to 1 of 1
  1. Bill Siggelkow photo Playing to Weakness
    2005-03-03 11:25:49  Bill Siggelkow | O'Reilly Author [View]

    • Playing to Weakness
      2005-06-01 03:34:34  isto.nikula [View]

1 to 1 of 1