There’s always a better way
Wednesday, February the eighteenth, two thousand and nine.…it’s knowing when to stop that’s tricky.
Recently, while fulfilling a challenge (actually I think it was a joke, but I couldn’t help myself) I had to solve, what I suspected would be, a fairly simple programming problem; get the number of seconds from any arbitrary time and date until the next again Friday.
So I go ahead and Google it.
Turns out a few other people had tried the same thing (I was using PHP), there were numerous messy and processor-hungry solutions out there. I read a few, got the general idea, then wrote my own. So, here’s the end product: http://www.whyisitnotfriday.com/
Feeling quite happy with the result I decide to dive into the PHP manual and start digging a bit deeper into its Date/Time functions, just out of curiosity …. turns out I could of saved myself quite a bit of time with a little PHP function; strtotime(”friday”).
Anyway, the point of my rambling is this; why do people always assume the first solution they stumble upon is the best one? I see it everywhere, from religion to programming.
I really wish people would start asking more fucking questions.