The Daily WTF
Follow
Representative Line: Tern on the Error Message
Ternaries are concise but can be difficult to read. A simplified ternary pattern is used throughout the codebase to enhance readability. This pattern sets a boolean property to true or false based on a condition, providing clear documentation of the boolean expression. The simplified ternary is a condensed version of the traditional if-else statement used to set boolean values. This pattern makes the code more explicit, verbose, and readable, eliminating the need to decipher complex boolean expressions. The traditional if-else statement for setting boolean values is considered annoying and useless, as it lacks clarity and indicates a lack of understanding of boolean operations.