1 Reply Latest reply on Nov 28, 2012 11:57 PM by jschellSomeoneStoleMyAlias

    cor design pattern

      I use cor design pattern little different than what I see in google.

      here is m y cor
           public static  abstract  class CORHandler    {
                CORHandler  nextHandler;
                public void process(){
                     }else {
                          if(nextHandler!=null) nextHandler.process();
                protected abstract  boolean canHandleRequest();
                protected abstract void  handleRequest();
                public void setNextHandler(CORHandler  corHandler){
      this serves most of my need and also I can override process method for change behaviour .
      this code helps me save lots of if/else conditions , I am not passing any object to the method here reason is I use this always as inner class inside a method so I can access all final fields
      advice me is this right when applying cor pattern?
        • 1. Re: cor design pattern
          Making it a base class increases connectivity to no good purpose.

          It violates the concept of inheritance by making the objects COR classes which is not what they are.

          It violates the principal of COR in that the intent is to handle a responsibility not all responsibilities. This same problem obscures the pattern as well by eliminating the objects to be acted upon.