Usable API
Here are a couple of suggestions when you design your API. They are mostly about dealing with passing collections:
-         "params" is your friend, it is much nicer to be able to write this:
That to write this:foo.WithArgs("Bar","Foo","Fubar");
The former is easier to read and to write.foo.WithArgs( new string[] { "Bar", "Foo", "Fubar"} );
 -         One very important this to be aware of, try very hard not to write declarations like this one:         It is very confusing to read afterward, and removing a single parameter may change the intention of the code.
void WithArgs(string username, string password, params string[] optional);
 -         When you need a method that takes several collection parameters, try to ensure that the most commonly used argument at the end, so it would be easier to extend:
It is much easier to work with this method.FindAll(Order[] orders, params ICriterion[] criterias)
 -         Finally, when you have code like the above, be sure to specify an overload that takes a single parameter of the first one, like this:         This saves you the need to define an array for the simple cases.
public static T FindFirst(Order order, params ICriterion[] criterias)
 

Comments
Comment preview