Everybody seems to be talking about computer coding, why it's important, and how it's the way of the future. But what exactly is coding? I'll explain by starting with a personal story.
When I was in elementary school, I enjoyed making up imaginary worlds filled with characters and items. I would draw maps of these worlds and write down all of the characters and items. I would then have my dad explore these worlds, and how this worked was my dad would tell me what he wanted to do in a particular world, and I would respond with what happened as a result. Essentially, my dad was a user giving me commands, and I was a computer processing those commands.
When I was 13 years old, my parents sent me to a computer camp for one week where I was introduced to coding. Back then, most people didn't talk about coding, and those who did called it computer programming, which is just another name for coding. During that one week at computer camp, I created another imaginary world, but this time with computer code. Instead of drawing maps and writing down characters and items on paper, I put all of that data in my code.
When I returned home from computer camp, I excitedly had my dad explore my new world. But this time, instead of telling me what he wanted to do, he typed commands into the program that I had created, and my program would automatically respond. I was no longer the computer processing commands. I had written code to do the processing for me.
That is essentially what coding is, telling the computer how to process commands on your behalf. My first program was primitive. There were no graphics or sounds, only a blinking cursor where users would type commands. Since then, I have created more sophisticated programs with friendly buttons, fancy animation, and nice music. But the underlying code is essentially the same. It's just telling the computer how to process user interaction, whether it be text commands, button clicks, phone swipes, or body movement.
But coding is not easy. When I coded an imaginary world for my dad, I had to painstakingly tell the computer every command that a user might type, and tell the computer to check every relevant variation in the game's current state in order for it to respond appropriately. If my dad typed a command that I had not coded, the computer would not know what to do, even if the command was very similar to a command that I had coded. If I forgot to check a particular variation in the game's current state, no matter how insignificant, the computer might respond with something nonsensical. Coding is the art of covering all of the possibilities and removing all ambiguity.
The purpose of code is to automate human tasks. After writing my first piece of code, I no longer had to be present for my dad to explore my imaginary world. My code took my dad through my world on my behalf. In some ways, my code did a better job than I did. Unlike me, my code never had to go to school or go to sleep, it never got bored of processing commands, and it never made a mistake because it forgot to write something down. And that is the beauty of code. It will do extremely boring tasks without complaining, it will do them extremely quickly, and it will do them flawlessly. Well, it will do them flawlessly only if the coders did their job well.
David Keller, founder of Mr. Code's Wild Ride