Friday, January 23, 2015

Table – Add To Table Refactoring (Part 2)

Refactoring the remaining large function called from the add to table function was painful, but was finally achieved, though the result is far from ideal.  The problem is that there are several variables that need to be shared among the functions.  Some functions take a variable and then return the same variable possibly modified.  Another needs to modify two arguments, so couldn't return both so reference arguments were used.

Having arguments used as both input and output can be confusing when reading code (arguments should be used for inputs, return values should be used for outputs).  Sharing several variables between functions implies that the functions should be wrapped up into another class.  This will be the subject of the next refactoring change.

[branch table commit a9cd8e9a1a]