Re:Clear is better than clever [pdf]
by ivanhoe on Monday May 06, 2019 @05:31PM
(#19844101)
IMHO this is pretty hard to read, unless I guess you work on code written this way every day (and most of us don't). It's not that I can't understand it, but it takes unnecessary extra effort and time to process. I want to be able to scan quickly throw a code, concentrating on understanding the logic behind, not on syntax itself, and that's very hard when it's written very dense like this. For me ternary operators are great when used on simple expressions, without nesting, and always with brackets around expressions to help eyes to navigate. In your example I'd always prefer if/elseif/else structure in place of this (unless there's a spaceship operator of course).
[ Parent
| on HN ]
There are no comments on this comment yet.