News for hackers. Stuff that matters.
Re:Why Swift Guard Should Be Avoided by KarlFreeman on Saturday January 02, 2016 @06:20AM (#10825861)
I feel like somewhere between the two would pass. Keep the validation as distinct functions but inline validatedItemNamed, reduceDepositedCoinsBy.
Re:Why Swift Guard Should Be Avoided by static_noise on Saturday January 02, 2016 @06:39AM (#10825897)
My problem with putting the validation in an own function is that this should only be done if the validation itself is generic like "check checksum" but not if it relates to the actual logic like "A must be smaller than B".

At first I wouldn't expect a function "validatedItemNamed" to check the price. While it checks the price it doesn't check the inventory number.