Since unit test cases should be written before the actual code, you cannot say that code is done when the unit test all pass.
You need the RRR rule.
- Legibility (Readability)
- Code that runs on and one in a single function that spans a whole page of print is too much. Refactor the function calls down to clean testable segments.
- Code duplication (Repetitiveness)
- Code segments that show up more than once, need to be wrapped into a function call and unit tested on their own.
- Performance optimization (Run Time)
- Try moving your child functions to stateless static functions. Also look at how you may recycle or preserve state from prior child functions, to prevent rebuilding the wheel with every child call.
- Note that I don’t call this runtime, which is a state of coding vs running, but Run Time, as in the time for your code to complete running through a task.
There is a 4th R, Resource… Your team members are a resource for you, and you for them. Do code reviews that focus on refactoring. Call them refactor views.
1 Comment