Re:John Carmack on Inlined Code (2014)
by scarface74 on Tuesday January 22, 2019 @10:31AM
(#18968930)
If you turn all those code blocks into functions, itβs no longer easy to visually inspect the code to see all the places where variable X is modified. It might not be a net win for readibility.
This goes back to not modifying global (or class global) variables and using a functional style. If you need to pass four or five variables put them in your languages equivalent of a pass by value struct.
In the case of my favorite IDE, Extract Method and creating a struct/class from a parameter list is an automated, guaranteed safe refactor.
This goes back to not modifying global (or class global) variables and using a functional style. If you need to pass four or five variables put them in your languages equivalent of a pass by value struct.
In the case of my favorite IDE, Extract Method and creating a struct/class from a parameter list is an automated, guaranteed safe refactor.