Re:It's probably time to stop recommending Clean Code (2020)
by gentleman11 on Tuesday May 25, 2021 @06:23PM
(#27283504)
Carmack once suggested that people in-line their functions more often, in part so they could “see clearly the full horror of what they have done” (paraphrased from memory) as code gets more complicated. Many helper functions can be replaced by comments and the code inlined. I tried this last year and it led to overall more readable code, imho.
[ Parent
| on HN ]
Re:It's probably time to stop recommending Clean Code (2020)
by cassonmars on Tuesday May 25, 2021 @09:18PM
(#27284987)
You’re very close to his actual quote, he was referring to the horrors of mutating shared state: http://number-none.com/blow/john_carmack_on_inlined_code.htm...
Re:It's probably time to stop recommending Clean Code (2020)
by gentleman11 on Wednesday May 26, 2021 @12:00AM
(#27286157)
Thanks for the link
> The real enemy addressed by inlining is unexpected dependency and mutation of state, which functional programming solves more directly and completely. However, if you are going to make a lot of state changes, having them all happen inline does have advantages; you should be made constantly aware of the full horror of what you are doing. When it gets to be too much to take, figure out how to factor blocks out into pure functions (and don.t let them slide back into impurity!).
Re:It's probably time to stop recommending Clean Code (2020)
by physicles on Wednesday May 26, 2021 @12:43AM
(#27286443)
Carmack is such a great communicator of software development philosophy. He also wrote a classic article on "Functional programming in C++": https://www.gamasutra.com/view/news/169296/Indepth_Functiona...
Re:It's probably time to stop recommending Clean Code (2020)
by gentleman11 on Wednesday May 26, 2021 @02:25AM
(#27287077)
Do you know anything else he wrote like these?