From: Robert Klemme Date: 2008-03-11T04:35:00+09:00 Subject: Re: Which is better -- method option or multiple methods? On 10.03.2008 20:09, Paul Mckibbin wrote: > Method options are better if you ever want to extend it. How is that? How can a single method that switches over one or more arguments to decide what to do be easier extended? What if you detect that the new or one of the algorithms needs an additional argument which is not needed by other algorithms? > I personally > would have both in library code, but would be inclined to keep the > multiple method code private to keep the interface clean. A clean interface in my world is one where one method does exactly one thing - and not multiple things. If all those algorithms share some common code this should go into another method that all of them use. Much cleaner, more maintainable and easier to understand. Just think about a method's documentation, that can do 5 different things vs. five methods with their own documentation. I tried to come up with a good search string for Google, 'method "do just one thing"' is currently the closest that reveals some hits about the matter. Kind regards robert