Beware "Clever Code"

Once upon a time... I wrote some code to talk to an API that tried to be a bit clever about merging requests together. Some weeks or months later, it was complaining that the request I was looking for had too many results, and that I should adjust the input filters to look for a shorter date range or less datapoints. Because I'm lazy, I figured I'd just split the request I was passing my own code into two requests with shorter timespans.

My CLEVER code merged the two requests because they covered a contiguous timespan.

EVEN when I passed the two requests out-of-order.

I'm going to get in my time machine and go back to when I was writing that code, and just smack myself on the head.


Waider