Everyday developers take a seat in front of a computer that eats code and outputs magic. Like a magician, the computer takes the code we’ve written and offers us to inspect it for one last time before we hit refresh. Then the machine takes the “ordinary something”, in this case – our code, and makes it do something extraordinary; for example – when everything breaks.
Every great magic trick consists of three parts or acts. The first part is called “The Pledge”. The magician shows you something ordinary: a deck of cards, a bird or a man. He shows you this object. Perhaps he asks you to inspect it to see if it is indeed real, unaltered, normal. But of course… it probably isn’t. The second act is called “The Turn”. The magician takes the ordinary something and makes it do something extraordinary. Now you’re looking for the secret… but you won’t find it, because of course you’re not really looking. You don’t really want to know. You want to be fooled. But you wouldn’t clap yet. Because making something disappear isn’t enough; you have to bring it back. That’s why every magic trick has a third act, the hardest part, the part we call “The Prestige”.
― Christopher Priest, The Prestige
Spectators of a magic trick, as quoted above, don’t want to look for the secret, they don’t want to know how the ordinary did something extraordinary because they want to be fooled. But, we developers, should behave exactly the opposite. We want to know what broke our program, we want to find the secret to how our unequivocal piece of code, came out differently than what we had expected.
Many beginner-level developers are acting like they’re spectators in a big magic show and while they are the ones who write the code, they still can’t see the secret (that they put there) that breaks their code. I call it “the spectating developer syndrome” and it shackles developers’ hands in finding a solution to the problem their own code created!
As part of my Computer Science studies I took a course with a controversial instructor that had a special combination of arrogance and honesty. If I had to choose only one sentence, throughout my studies, that influenced me the most, I would choose his words: “You’re developers, you can do everything. If something goes wrong, you made it so, which means you can also solve it.”. Then he emphasised: “Every problem in code has a solution and you’re the ones who can solve it.”
This point he was making helped me understand something – we’re magicians, not spectators! It’s true we’re only the ones that hand ordinary code to the sacred computer to examine, but we attach more to that package and that’s what makes our seemingly unaltered code to be something a bit different from what we intended. If we are the ones altering the ordinary to make it disappear, then we are also the ones that can bring it back.
We have tons of tools these days to debug and profile our apps. We can look through network transmissions, or inspect how elements rendered on the page, profile our app’s processing of procedures or watch how its memory usage and frame paint speed behaves along a timeline, we can simulate different devices and features or break inside code and change it in run-time.
You are developers, you can do everything! All major browsers today offer an amazing Developer Tools drawer (Chrome, Firefox, Safari, Internet Explorer) that you can use and the crazy thing is that it’s so easy to use. You just really have to try once. Without it, you’re just a spectator at your own show. Don’t be a spectator, be the magician.