This is a code base for doing steps following the article refactoring video store js.
This initial video store code is the js version of original example in 1st version Refactoring.
This statement function is an example of the smell Long Method.
Decomposing the origin one into several functions:
-
Turn logical chunks of code into their own functions using Extract Method.
-
use Replace Temp with Query to turn temporary variables into a function
Specify the output format as an argument to the statement function by using Add Parameter,
-
move nested fns to the top context. Deal with function that doesn't refer to any others 1st.
-
Declaring some partially-applied local functions
- wrap the data in objects
- apply Move Method to function doesn't call any others
- add data middleware to transform the customer data structure so that it has all the data the printing functions need
- Add unit test