I’m working on a legacy VB.Net code base. There are very few functions that return values, most of the code is in subs/void methods. The general strategy seems to be to pass everything in by reference, mutate it, and then observe the mutated state.
There are some methods that have as many as a dozen parameters that are mutated in this fashion.
I find it very difficult to reason about the code written in this way. It’s also rather difficult to write tests to aid in refactoring.
I’d like to know if there’s a name for this, mainly in the hopes that I can find better ways of moving the application towards a better structure.
EDIT
I probably should have mentioned that calls tend to be limited to within their own multi-thousand line class files.
Based on the answer below it looks like I need to use extract method to make the methods have meaningful names and to deal with the optional parameters. Once I’ve done this I can start using extract class to separate out functional unit.
Fun times.
1
Sounds like Data Envy, where a routine mostly or completely uses a different object.
What you should do is move the routine to the class whose data is being changed.
If you have long routines that take a dozen parameters, you may need to extract the method before moving it.