title: Best design method to allow user to change a class method - Delegates/Inheritance/Interface?
body: <p>I'm writing <code>class Movies</code> that, for simplicity sake, is responsible adding/removing/keeping a set of movies. Movie instance has many params such as length, color, genre, etc. <code>Movies</code> should also allow a user to call <code>Movie bestMovie()</code> which will return <em>'the best'</em> movie in the set.</p>
  
  <p>Assuming that I already have two ways of choosing a best movie implemented (one based on highest IMDB ranking, the other on Rotten Tomatoes) but I want to allow the user to add new types of decision algorithms (e.g. based on length + season of the year) for example. What is the best design to allow this?</p>
  
  <p>Thoughts that I had:</p>
  
  <ol>
  <li>Allow the user to inherit from <code>Movies</code> and override bestMovie(). Feels like a wrong usage of inheritance.</li>
  <li>Create an interface called <code>MovieSelection</code> and implement <code>class IMDBMovieSelection</code>. The user can then add <code>class SeasonMovieSelection</code>. <code>Movies</code> Ctor will then get <code>MovieSelection</code> as param which it will use in <code>bestMovie()</code> - It feels wrong to create objects just for "signaling" a method to my main object</li>
  <li>Use delegates/anonymous functions when calling <code>bestMovie(&lt;anonymous function&gt;)</code> (similar to what I would use with <code>List.Sort(IComparable)</code>) - Feels not scalable and hard to maintain, especially if the function is a complicated one.</li>
  <li>Provide ability to extend the class using a partial class - not even sure if that's a real option</li>
  </ol>
  
  <p>Would appreciate any insights here. I'm sure I'm not the first one to face this issue, but didn't know what exactly to search for.</p>
  
  <p>Thanks</p>