Re:A Short Cautionary Tale About Refactoring
by alkonaut on Sunday March 21, 2021 @06:06AM
(#26529349)
The danger is in the combination of all 3: non-obvious assumption (code should work offline), lack of tests, lack of documentation of the assumption.
Flip ANY of the three, and there is no problem. Had I been the original author I would have gone for the comment, itβs clearly the simplest one in this case.
Normally, if unit tests were missing, I would add them before starting refactoring. In this case, to be honest, I'm not sure how I could have written a unit test to catch the issue. An E2E test is the only one that comes to mind. Please let me know if I am missing an easy way to test for a 404 image when offline. Thank you!