4 ms·
Brian Kernighan on the Elements of Programming Style [video]
- fao_ 8y ago> https://video.ias.edu/PiTP2009-Kernighan https://video.ias.edu/PiTP2009-Kernighan For some reason this appears as a completely blank page to me.
- userbinator 8y agoIt's a rather large page with tons of JS, but whose only apparent purpose is to embed YouTube video 8SUkrR7ZfTA which a sibling comment here has already linked.
- yesenadam 8y agoyoutube version https://www.youtube.com/watch?v=8SUkrR7ZfTA https://www.youtube.com/watch?v=8SUkrR7ZfTA
- gugagore 8y agoFor 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.