title: What is a good design pattern for the following situation?
body: <p>I have different string distance metric implementations at hand (all of them are in C#) for example, Levensthein, NeedlemanWunsch, Jaccard, etc. The job of these are same basically; take two strings as input and return a similarity score in the range [0,1]. So, I planned to make these classes to implement  the same basic interface, as in the following:</p>
  
  <pre><code>public interface IStringDistanceMetric
  {
      //Return a similarity between 0 and 1.
      double CompareSimilarity(string strA, string strB);
  }
  </code></pre>
  
  <p>Each of my metrics will implement this method. But there are some metrics which will directly operate on two strings, without any other input and there are some metrics which needs some extra parameters( like the penalty given for a gap in one of the input strings, etc.). In general, I can give these parameters either in the constructor stage or just before calculating the similarity score.</p>
  
  <p>My question is, in general, what would be a good design practice in order to handle such differences between the concrete distance classes? I aim that the client code which wants to use any distance metric should be oblivious to any underlying implementation detail, after it has decided use a specific kind of metric. The most obvious way would be to implement something like:</p>
  
  <pre><code>  IStringDistanceMetric metric;
    if(metricType == Metric.NeedlemanWunsch)
    {
      metric = new NeedlemanWunsch(parametersNW);
    }
    else if(metricType == Metric.Levensthein)
    {
      metric = new Levensthein(parametersL);
    }
    .
    . 
    .
  </code></pre>
  
  <p>But this doesn't look a good solution to me. I am kind of surprised to find myself stuck at such a basic looking design problem. Any help would be appreciated.</p>