title: Erlang style - case vs function pattern matching
body: <p>I've got to the stage where I've written quite a bit of Erlang code now, and I can see some style (bad or good) creeping into the way I've been writing it. This particular idiom I'd like some opinion on - is it better (more readable/faster/whatever) to convert case style statements to function pattern matching?</p>
  
  <p>E.g.</p>
  
  <p>Compare (a contrived example)</p>
  
  <pre><code>case {Size &gt; 100000, Type} of
      {true, ets } -&gt;
           %% Do something to convert to dets
           something;
      {false, dets} -&gt;
           %% do something to convert to ets
           somethingelse;
      _ -&gt;
           ignoreit
  end;
  </code></pre>
  
  <p>with</p>
  
  <pre><code>...
  maybeChangeStorage(Size, Type)
  ...
  
  maybeChangeStorage(Size, ets) when Size &gt; 10000 -&gt;
     something;
  maybeChangeStorage(Size, dets) when Size &lt; 10000 -&gt;
     somethingelse;
  maybeChangeStorage(_,_) -&gt;
     ignoreit.
  </code></pre>
  
  <p>I prefer the latter in most cases but I'd be interested in other opinion.</p>