4 ms·
>> If the function is small << And if the function is not small?
by igouy 14y ago
>> If the function is small <<
And if the function is not small?
- mseepgood 14y agoThen extract functions until it's small, a.k.a. refactoring.
- marshray 14y ago...and if you end up needing to pass 20 variables via reference for state?
- masklinn 14y agohttp://www.refactoring.com/catalog/introduceParameterObject.html http://www.refactoring.com/catalog/introduceParameterObject....
- marshray 14y agoYou have a group of parameters that naturally go together. ...when you have a bunch of methods that call each other, all of which have a clump of parameters that need this refactoring. In this case you don't want to apply Introduce Parameter Object because it would lead to lots of new objects There are times when this transformation yields simpler code, there are times when it makes things more complex, and there are a lot of cases in between where it's a judgment call.
- genwin 14y agoThen I might set a variable and return that. The goal is to make the function readily understood.