3 ms·
John carmack said much the same and I have been following it ever since. Of course linear code is easier to read, if follows the order of execution. It minimize
by tlarkworthy 3y ago
John carmack said much the same and I have been following it ever since. Of course linear code is easier to read, if follows the order of execution. It minimizes eye saccades.
Some code needs to be non-linear for reuse. Then execution is a graph. If you code does not exploit code reuse from a graph structure, do not bother introducing vertexes where a single edge suffices.
http://number-none.com/blow/blog/programming/2014/09/26/carmack-on-inlined-code.html http://number-none.com/blow/blog/programming/2014/09/26/carm...
- Symmetry 3y agoSomething Carmack calls out but the OP doesn't is that if you can break out logic with no side effects into its own function that's usually a good idea. I think the left side would have benefited from pizza.Toppings = get_pizza_toppings(order.kind) in this case to keep the mutation of the pizza front and center in the main function here.