3 ms·
For the first example, with the ternary operator, I think the original has an advantage that it does not mention `Armed` twice, unlike the improved version. Th
by gugagore 8y ago
For the first example, with the ternary operator, I think the original has an advantage that it does not mention `Armed` twice, unlike the improved version.
The presenter mentions that there are a few extra characters, I know, but my issue is not extra characters, but duplication.
- solipsism 8y agoWhen we talk about duplication we are usually talking about doing some work twice or defining something twice. Using a name twice is not the type of duplication we try to avoid.
- gugagore 8y agoI don't think you can simply assert that. People sometimes do try to avoid naming something twice, especially if it has an unwieldy name. For example, to cube a quantity, I don't like to write "xxx". Imagine if x had another name, like "player_position.x". Sometimes people try to avoid naming something even once! Such as in an anonymous function.