So imagine you have a robot. The robot can walk forward and also put his hand out to detect if he’s about to run into a wall. You say, “ok robot. Take a step forward. Put your hand out. If you detect a wall, stop. If you don’t, take another step. Then put your hand out… and just keep doing that til you detect a wall. Then stop.”
You just programmed. Seriously. That’s all there is to it. You have to break tasks down into smaller steps and then tell the computer.
Okay, so maybe there’s a little more to it than that. For instance you might have to….
- Tell the robot how to take a step. (pick your right foot up. move your right foot forward. Put your right foot down. Pick your left foot up…)
- Tell the electrical parts how to pick the foot up. (Turn this switch on, turn that switch off.)
- Tell the robot to be green and have a pink flower on the top.
- The GUI(Graphical User Interface) designer thinks that the pink flower should really be 13 pixels to the right.
Oh, and then there’s debugging. Like…
- The robot isn’t picking up it’s left foot, just it’s right foot, please figure out why and fix it.
- The robot isn’t stopping when it runs into the wall, please figure out why and fix it.
- Or – some users insist on using Robot Explorer 6, and so you have to write special code to work for that robot version since it refuses to follow w3 standards.
Or, perhaps you’ll have to handle exceptions.
- The robot tripped over a toy and fell over. This was unexpected. Make it say “Error. I cannot continue. Help.”
And that is my life. Okay, so yeah, there’s about 99% of being frustrated because it’s not doing what it is supposed to and you’re really starting to question your qualifications, your career choice, not to mention your sanity… but then there’s that breakthrough. The sheer unadulterated joy that comes after banging your head on the monitor for 10 hours straight – when you test your code and it does exactly. what. it’s. supposed.to. You win. You win at coding. In that moment, you win at the world. You are victorious.
Okay, so it might not be your cup of tea. Maybe you don’t like puzzles. Maybe you don’t like problem solving. And hey, that’s cool. I don’t like blood or needles or chemistry or languages or a whole host of other really important things necessary for other careers. But when it comes right down to it, I *love* programming. And you don’t have to be scared of it anymore.