I'm a full on proponent of coding for clarity rather than brevity or even efficiency and have lobbied for that for decades, and refactored plenty of code to that effect. But I am equally fond of and a proponent of prudent use of ternaries ... encapsulating a single idea completely and elegantly aids comprehension and clarity IMHO.
Admit I don't read a lot of foreign code so don't know, and to be honest even if I did (read a lot of foreign code) I would be very wary of sampling bias before I drew any broad industry wide conclusions. But for my part I love this construct and use it a lot:
I'm a full on proponent of coding for clarity rather than brevity or even efficiency and have lobbied for that for decades, and refactored plenty of code to that effect. But I am equally fond of and a proponent of prudent use of ternaries ... encapsulating a single idea completely and elegantly aids comprehension and clarity IMHO.
Totally, not against ternaries - I just feel that have become a hammer for some people and being used too liberally 😀
Admit I don't read a lot of foreign code so don't know, and to be honest even if I did (read a lot of foreign code) I would be very wary of sampling bias before I drew any broad industry wide conclusions. But for my part I love this construct and use it a lot:
It is extremely clear and uncluttered when used appropriately and easy to read.