On Tuesday, 25 October 2016 at 22:53:54 UTC, Walter Bright wrote:
It's a small bit, but the idea here is to eliminate if conditionals where possible:

https://medium.com/@bartobri/applying-the-linus-tarvolds-good-taste-coding-requirement-99749f37684a#.nhth1eo4e

This is something we could all do better at. Making code a straight path makes it easier to reason about and test.

Eliminating loops is something D adds, and goes even further to making code a straight line.

One thing I've been trying to do lately when working with DMD is to separate code that gathers information from code that performs an action. (The former can then be made pure.) My code traditionally has it all interleaved together.

Personally, a large amount of control flow statements (and especially nested control flow) makes it difficult for me to understand what the code does (not to mention debugging it). Unfortunately, it can be difficult to eliminate (or hide) control flow without creating needless complexity in other parts of the program. For instance, Linus' "good taste" example uses pointers explicitly and I would argue that this too is "distasteful".

On Tuesday, 25 October 2016 at 22:53:54 UTC, Walter Bright wrote:
One thing I've been trying to do lately when working with DMD is to separate code that gathers information from code that performs an action. (The former can then be made pure.) My code traditionally has it all interleaved together.

An obvious example of code that gathers information separated from code that performs an action is exceptions. :)

Reply via email to