Refactoring a User Test Function
You run into code that sets off the WTF alarm every so often. Ideally, this code wouldn’t have been introduced in the first place, but often that is not the case.
This article analyses a single function and improves it incrementally by simplifying the code, abstracting dependencies, the Single Responsibility Principle, and introducing external configuration.