Lets assume we have a class car.
How would You name parameters of function that takes two different cars?
void Race(Car first, Car second);
or maybe
void Race(Car car1, Car car2);
The same situation with function that takes car and list of cars as a parameters.
I’m used to name ‘cars’ for list of cars, so it is inconvenient to use names like:
void Race(Car car, List<Car> cars);
Any suggestions about names?
I personally choose names that represent how the cars will be used.
In your example, I’d probably just have
void Race(IList<Car> cars), since each car is equivalent.If there are always two, equivalent options, using firstCar and secondCar seems reasonable.
However, if you were doing something like moving parts from one car to another, I’d be very descriptive, ie:
The more descriptive you can be in your argument naming, the easier your API becomes for usage.