Two functions, or one function with different params?
问题 This is a very generic 'best practice' question, but here's an example. Let's say I have a movie cataloging app. I want to give my users the chance to specify, say, IMDb or Metacritic for their synopsis/ rating info. Do I do this: if (preferredSupplier == "imdb"){ getIMDbRating(movieName); }else{ getMetacriticRating(movieName); } Or this: getRating(movieName, preferredSupplier); I like the second one better, but it means that function will have to follow vastly different logic depending on