Try to refactor the concept and not only the code. Refactoring to remove duplicate code leads to OnceAndOnlyOnce. But if not done properly, it might lead to more complex code. So when you refactor, step back and look at the concept. May be the concept also has to be refactored to make the system more simple to understand. I have found refactoring or changing the concept make the system much more simpler and flexible. : ''Sound advice'' : On very rapid (say 1-8 weeks) on-site web development projects, this approach is invaluable: write a spec, code the system, and as you go along, ascertain which aspects of the spec are either too much effort for too little results, or which can't be done in the time schedule, and also factor in anything the client "just thought of". At the end, refactor the original specification into a RetrospectiveRequirement and as long as the client's happy with the product, job done. Doing it this way not only makes for solid code, but also gets rid of any fluff that was originally thought of as a WouldBeNice, but as it turns out, isn't necessary. Of course, this is just my ad hoc way of implementing DoTheSimplestThingThatCouldPossiblyWork. -- DarrenIrvine ---- Could we get an example of code that needs its concepts refactored? ---- Suppose we have a requirement to validate the parameters passed to a controller class. Then we have the interface public interface Input''''''Validator() { public boolean validate(); } public interface Controller() { public void setInputValidator(Input''''''Validator validator); public void executeReq(); // It will call validator.validate() before processing the request. } And the code that calls is public class My''''''Servlet extends Http''''''Servlet { public void doGet(Http''''''Servlet''''''Request req, Http''''''Servlet''''''Response res) { ... Controller usrContrl = new User''''''Controller(); usrContrl.setInputValidator(new User''''''Input''''''Validator(req)); usrContrl.executeReq(); } } Now, a functionality is required by the client so that they can execute their own code with this Web Application. We can implement it as Executor. The controllers take a list of executors and execute them one by one. The list is configurable. public interface Executor { public boolean execute(); } public interface Controller() { public void setInputValidator(Input''''''Validator validator); public void setExecutors(Executors[] execs); public void executeReq(); // Now it will call both validator and executors before processing the request. } public class My''''''Servlet extends Http''''''Servlet { public void doGet(Http''''''Servlet''''''Request req, Http''''''Servlet''''''Response res) { ... Controller usrContrl = new User''''''Controller(); usrContrl.setInputValidator(new User''''''Input''''''Validator(req)); // No need for this. Use Executor instead. Executor[] execs = config.getExecs("User''''''Controller"); usrContrl.executeReq(); } } Here we can simplify the concept by removing Validator concept and implementing that code as an Executor. So instead of 2 concepts, we have only one concept. -- VhIndukumar ---- CategoryRefactoring