DEV Community

Discussion on: "XY Problem" in the Wild.

Collapse
 
somedood profile image
Basti Ortiz

This has happened to me a lot of times. I remember how I once made a utility function that takes in a URL string as an argument to sanitize some user input. The utility function returns true or false depending on the URL's "cleanliness" and validity. This utility function soon became the reason why I spent four months trying to figure why a side project of mine is failing.

I had blamed the dependencies I used (since I was using the URL to fetch a resource) for the bug, so I waited... and waited... and waited for it to get fixed. It never got fixed until I realized later that the error was on my part. The utility function sanitizes the URL string by invoking its toLowerCase method. By converting the string to lower case, the case-sensitive URL becomes invalid and results in a 404. It was the dumbest thing I have ever done.

In my case, I tried to solve a problem by seeing if my dependencies caused the error, when I should have taken a step back, defocused for a minute, grabbed a rubber duck off my desk, and had a nice relaxed conversation to solve my seemingly impossible problem that lingered for months.