2 ms·
If I run into that situation, I refactor the code so that I can better understand it the next time. To not do so is to waste all that time you spent understandi
by vinceguidry 11y ago
If I run into that situation, I refactor the code so that I can better understand it the next time. To not do so is to waste all that time you spent understanding it.
> It's usually something simple like, "This cast avoids a special case in method X", or along those lines.
If I had an issue like that, I'd fix method X to be more accepting of unclean inputs.
- tbrownaw 11y agoThe problem is that method X is a remote invocation into another system that has different change-control procedures, a different ticketing system, and a different release schedule.
- vinceguidry 11y agoI'd use a gateway class and intention-revealing method names, even if all that method was doing was casting a value. I'd call it ".edge_case_fix", (but described better than "edge case") and do the same for every weirdness in the external system that requires workarounds.