A colleague and I are discussing best practices regarding ordering method parameters. The goal is to establish a standard in our organization to improve readability and productivity by giving our methods common signatures. We are merely establishing guidelines for the recent grads we are hiring.
Example (userId is always passed in to audit the calls):
GetOrders(string userId, int customerId); GetOrders(string userId, int[] orderIds); GetCustomer(string userId, int customerId);
My argument is the following:
- common arguments are left most.
- remaining arguments are based on importance
- optional (nullable) arguments last.
His argument is essentially the opposite.
I'm not asking for a right or wrong answer here, nor a discussion. I just want to see what standards exist already.
Thanks!