title: How much OOP_Crazy should real life programmer be?
body: <p><b> Given :</b>
  Complex algorithm. </p>
  
  <pre><code>switch obj.field1 + "-" + obj.field2
  case "A-A":
      return Sample(obj){Error = "Type can't be matched"}
  case "A-B":
      {
      if(obj.field3 != null){
          var match = otherObjectCollection.FirstOrDefault(otherOb.field2 == obj.field3);
          return mathc != null? Sample(obj,match) : Sample(obj){Error="Can't find match"}
      }else{use field4...}
  }
  case "A-C":
  {
  var related = objectCollection.FirstOrDefault(parent.field4 == obj.field3);
  if(related == null)
   return Sample(obj){Error = "Can't find parent"}
  else {
    if(related.field3 != null){
         var match = otherObjectCollection.FirstOrDefault(otherOb.field2 == related.field3);
         return mathc != null? Samble(obj,match) : Sample(obj){Error="Can't find match"}
    }else{ use field 4 ...}
  
  }
      }
  </code></pre>
  
  <p>And so on. A lot of tricky rules. I came up with next <strong>decision:</strong></p>
  
  <pre><code>abstract class AggregationChain{
      protected MyObj Obj;
      abstract string Type{get;}
      abstract Priority Priority{get;}
      abstract bool Decide(MyObj obj);
      abstract Sample Aggregate(ICollection&lt;MyObj&gt; objects,ICollection&lt;OtherObj&gt; otherobjects);
      bool CanDecide(MyObj obj){
          if(Decide(obj)){
             Obj = obj;
             return true;
          }
          return false;
      }
   }
  </code></pre>
  
  <p>So now I can have ChainLinks for example:</p>
  
  <pre><code> class ABAggregationChainLink{
  
          string Type{get{return "A-B"}}
          Priority Priority{get{return Priority.High}}
          bool Decide(MyObj obj){ 
             return obj.fiel2 != null;
          }
          Sample Aggregate(ICollection&lt;MyObj&gt; objects,ICollection&lt;OtherObj&gt; otherobjects){
              var match = OtherObjectCollection.FirstOrDefault(otherOb.field2 == obj.field3);
              return mathc != null? Samble(obj,match) : Sample(obj){Error="Can't find match"}
          }
  
       }
  </code></pre>
  
  <p>In this example i'll need to create one more A-B ChainLink that will handle "else" situation. And for all switch cases i'll need to create different ChainLinks. This of course increase number of classes and time for implementation but classes more suitable for unit testing and from my point of view more extandable and flexible. </p>
  
  <p><strong>Question :</strong></p>
  
  <ol>
  <li>I'm thinking - may be I'm overexcited by Open-Close and "Good
  programming" and for real life application it is better just create
  method with switch and take care of reusable parts? </li>
  <li>I have
  filling that here may be better solution?</li>
  </ol>
  
  <p>PS. This is not working C# code, I just tried to explain the main logic.</p>