I Slayed a Callback Dragon Today
I was writing some Core Bluetooth code on iOS when the dragon appeared.
A callback looks like a function. But it’s not a function; it’s an event disguised as a function.
Once you know the beast’s weakness, it’s simple, though not easy.
Don’t write callbacks. Write code to handle events. All events implicated by a particular objective. That code might be a state machine, or it might be something more complex.
[Read More]