3 ms·
Consider these three points: * it has been actually demonstrated that shorter programs contain less bugs, * code is read much more frequently than it's writte
by kubb 5y ago
Consider these three points:
* it has been actually demonstrated that shorter programs contain less bugs,
* code is read much more frequently than it's written, and to the point code is easier to read than code full of boilerplate and meaninglessness syntactic elements,
* menial tasks and distractions introduce mental fatigue that consumes your limited brain resources that you need to think about the structure of your code that is actually dealing with the problem at hand.
- stouset 5y agoThanks for this, it's exactly what I had intended to reply with. Every single one of these points is spot-on.
- throwaway894345 5y agoI’m skeptical about the first bullet—is it the fewer characters or the reduced complexity which results in fewer bugs. If the latter, then it undermines your point; if the former the I’m very skeptical as it would suggest we should all be writing minified code. With respect to the second bullet, I agree that code is read more frequently than it is written and that readability is paramount. I strongly disagree that minimizing the character count is the same as optimizing for readability. In particular, I find very syntactically terse languages like Haskell or Ocaml far harder to read—indeed ReasonML exists precisely because so many people find OCaml so difficult to read. With respect to the third bullet, you should think about your error control flow. The structure of your code doesn’t change whether you’re using Go’s “if err != nil” or Rust’s ? operator. The difference is a dozen characters. I can’t believe that the real cognitive load is in the actual pressing of keys, but if that is your experience then text editors often have a “snippets” feature or extension that will let you map that boilerplate to a hot key.
- deleted 5y ago[deleted]