My friend Chris Ferdinandi used to be really vocal about his preference for XHR over the Fetch API. He has since embraced the Fetch API, but I liked the thinking behind his reluctance.
So much, in fact, that I made an extremely geeky rhyme. It’s based on the song All Out Life by Slipknot:
Old means XHR
New means using Fetch
But old does not mean dead
And new does not mean best
The sentiment is thus: don’t use modern methods and APIs just because they’re new and exciting.
Yes, Chris made the switch, but it’s because he actually finds value in the new approach. He’s not using it just because it’s this shiny new thing that feels more exciting than old-school XHR.
Which of the following is more readable?
Sure, the arrow function is shorter (barely), but it’s a lot less readable. It’s not even obvious that it’s a function if you’re quickly scanning through the code. And yeah, it’s the fancy new way of doing it, but at the cost of of readability and browser support.
The trade-off is decidedly not worth it for me.
As Chris summarizes in his fantastic ebook, The Lean Web:
If you remember nothing else from this book, I want you to remember to think like a dev dinosaur and embrace old, stable, boring technologies and techniques.
I’m not against the new techniques. But the old methods are well established and they’re not going anywhere. All I’m encouraging you to do is think twice before adopting a new technology.
Will it really bring you value, or do you just want to use it since it’s new and exciting? 🤔
(Oh, and May the Fourth be with you) 🌌
If you have questions, feedback, or any other suggestions, please do email me. I'd love to hear from you!