Re:My takeaways from "Clean Code"
by jcampbell1 on Tuesday May 28, 2013 @09:06PM
(#5783973)
I just find that minimizing parameters makes a mess with tons of side effects. When I see nothing but 0 and 1 parameter functions, the code is typically doing the logical equivalent of refactoring `add(a,b);` into `push(a);push(b);add();` which makes a mess when there is more than the trivial case.
jQuery.ajax is a 33 parameter function. No one complains, and it is nice that it doesn't have side effects.
Re:My takeaways from "Clean Code"
by jacques_chester on Tuesday May 28, 2013 @09:14PM
(#5783999)
Sure. Usually when you find a strict rule, it's a rule to be considered ceteris paribus -- when all other things are fixed in place. So while thinking about parameters, I think about minimising them and ignore other considerations. When thinking about side-effects, I think about minimising them and ignore other considerations.
It's when the rules conflict that mere rule-following ends and professional judgement begins.
Basically, as noted legal scholar Captain Barbossa observed, they're less like laws and more like guidelines.
2. Some functions are queries that don't require an arguments. Eg. getVariable().