4 ms·
If you think these things are considered harmful, I'd encourage you to read "John Carmack on Inlined Code" http://number-none.com/blow/john_carmack_on_inlined_c
by cellularmitosis 2y ago
If you think these things are considered harmful, I'd encourage you to read "John Carmack on Inlined Code"
http://number-none.com/blow/john_carmack_on_inlined_code.html http://number-none.com/blow/john_carmack_on_inlined_code.htm...
"The flight control code for the Armadillo rockets is only a few thousand lines of code, so I took the main tic function and started inlining all the subroutines. While I can't say that I found a hidden bug that could have caused a crash (literally...), I did find several variables that were set multiple times, a couple control flow things that looked a bit dodgy, and the final code got smaller and cleaner."
If Carmack finds value in the approach, perhaps we shouldn't dismiss it out of hand.
Also worth noting his follow-up comment:
"In the years since I wrote this, I have gotten much more bullish about pure functional programming, even in C/C++ where reasonable... When it gets to be too much to take, figure out how to factor blocks out into pure functions"
- jsbg 2y agoThanks. This is the first instance of a respected software engineer arguing in favor of this style that I have read (contrast with Dave Thomas, Kent Beck, Bob Martin, etc.)!
- NiloCK 2y agoJohn Ousterhout's Philosophy of Software Design is a good source describing the tradeoff analysis that suggests this approach. https://milkov.tech/assets/psd.pdf https://milkov.tech/assets/psd.pdf