Wednesday, July 13, 2011

return bool

someFunction(true, false, false, true);


someFunction(Sensor.Enabled, Filtering.Disabled, Normalising.Disabled, Smoothing.Exponential);

I know which one is 

  • easier to read
  • easier to debug
  • harder to get wrong when you call it
  • slightly more effort initially.

1 comment:

  1. Agreed.

    Perhaps not available when you wrote this post, but the named argument feature of C# 4.0 gives another, possibly cleaner, solution to this:

    someFunction(sensor: true, filter: false, normalise: false, exponentialSmoothing: true);