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?
E.g.
Compare (a contrived example)
case {Size > 100000, Type} of
{true, ets } ->
%% Do something to convert to dets
something;
{false, dets} ->
%% do something to convert to ets
somethingelse;
_ ->
ignoreit
end;
with
...
maybeChangeStorage(Size, Type)
...
maybeChangeStorage(Size, ets) when Size > 10000 ->
something;
maybeChangeStorage(Size, dets) when Size < 10000 ->
somethingelse;
maybeChangeStorage(_,_) ->
ignoreit.
I prefer the latter in most cases but I'd be interested in other opinion.