On Mar 11, 2017, at 06:30 , Pascal Bourguignon <[email protected]> wrote:
> 
> My argument is that algebraic expressions are clearer than switches.

And it’s a *convincing* argument when you switch to a purely arithmetic problem 
(such as: how to add two numbers).

Seriously, though, I apologize if I let anyone think I failed to see the 
argument for — the advantages of — a concise numerical expression. Someone 
(Jeff) had already given that part of the answer. Yet there may well be 
multiple answers for which there is a valid argument.

Finally, before stepping out of this thread permanently, I’ll point out that 
although Jeff knew the (or, a) right answer, he inadvertently used the wrong 
operator. On top of that, there was a second correction to handle the edge case 
at upper end of the range, and the lower end edge case (if the battery level 
value is negative) still isn’t handled as the original code would. Finding an 
arithmetic solution to a logical problem is a non-trivial exercise, and “it can 
be argued that” for a reader of the code, decoding the resulting non-trivial 
arithmetic expression carries a non-trivial conceptual load.

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to