Question

In a C++ book, the author says we no longer need a function with a long parameter list because most of the parameters can be refactored into state variables in a class. On the other hand, a functional programming book says state variables are evil because it causes side-effects which cause bug-prone and hard to parallelize code. I'm getting puzzled. Should the code avoid relying on state variables as much as possible by moving its state variable into the function parameter list?

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top