3 ms·
It goes too far though. The virtue of simplicity needs to be balanced against the virtue of making proper use of advanced language features. A first-year stude
by MaxBarraclough 5y ago
It goes too far though. The virtue of simplicity needs to be balanced against the virtue of making proper use of advanced language features.
A first-year student is unlikely to understand C++ template metaprogramming, or just about any Haskell code, but that's not to say they should always be avoided in production code.
> The best code is no code at all
This can be interpreted as advice to avoid the 'inner-platform effect' anti-pattern. Good advice, but personally I'd rather express it in terms of the inner-platform effect.
- mplanchard 5y agoIME good commenting alleviates a lot of the “problems” with using complex language features. I’m thinking redis style comments (see here[0] for antirez’s philosophy on the issue). If you’re doing something that’s not immediately obvious, explain what you’re doing! That way others can verify it during review, and when someone is reading the code later they can read the comment to understand what’s happening rather than having to parse the code. IMO this applies just as much to simple constructs as to complex ones. Big for loop? Throw a comment at the top telling me what it does so I don’t have to read it when I’m skimming later. Better yet use `map` with a well-named function. Either way, provide a semantically meaningful summary of what’s happening. [0]: http://antirez.com/news/124 http://antirez.com/news/124
- MaxBarraclough 5y ago> If you’re doing something that’s not immediately obvious, explain what you’re doing! Agreed. Comments have their place, and some code is unavoidably involved, just by the nature of unavoidable complexity. The solution isn't always to write simple code. If it were, we wouldn't bother studying clever and efficient algorithms. Also, it's important to ensure comments are updated when code is changed. I don't know who originally said it: Stale and inaccurate comments are no longer comments, they're lies. That blog post looks worth reading properly, I admit so far I've only skimmed it.
- craftinator 5y agoThe mantra I use with my team is "comment the details, document the strategy".
- MaxBarraclough 5y agoSee the taxonomy of documentation solutions, https://documentation.divio.com/ https://documentation.divio.com/ and https://youtu.be/t4vKPhjcMZg?t=324 https://youtu.be/t4vKPhjcMZg?t=324
- sweeneyrod 5y agoThere are various universities that teach Haskell or similar languages in first year.
- adriancr 5y ago> A first-year student is unlikely to understand C++ template metaprogramming, or just about any Haskell code, but that's not to say they should always be avoided in production code. They're just the people to read a book on the topic and try to use it everywhere...