So a couple of days ago I came across this video called Coding is Not Difficult. This seemed to contradict the countless hours I spent getting a checkers piece to move for a checkers game that I programmed a few days prior. Maybe this video will change my mind, I thought.
Judge for yourself:
Yeah, that’s right. Bill Gates and Mark Zuckerburg say coding is not difficult.
I’m sure AP Physics C would be a breeze for Einstein but that doesn’t stop there from being a double square root curve. I am sure playing the piano was easy for Mozart but that doesn’t mean I can play Schubert.
Oh well, I thought, Bill Gates is just flexing his mad skills.
But I get it, I really do. Obviously coding is an important skill to learn, and if young people perceive it as difficult then they are less likely to try it. Still, there are times when I want to take action against my computer so that I can blame the code malfeasance on the hardware rather than the software, if you get my drift…
In the section below, I’ll tell you about some of my not-finest moments as a programmer.
So if you’re stuck on a coding problem and need somewhere to relax, unwind, laugh (or cry), you’ve come to the right place.
My “Adventures” With Programming
The other day I was programming a simple guessing game for my blog post on How To Build Your First Game in Python and for some reason one of two glitches would always happen. They never happened at once, but just when solved one, the other would pop up.
Now I hate to interrupt my own story. But what is up with that? It’s almost like the code is alive and playing games with me. “You can have one but not the other.” It’s not like they were even related glitches: one was the program allowed one more guess than I specified. The other was that the program would say my guess was incorrect even if it was correct.
I thought to myself: “I know the solution. The code is being mischievous so I need to take a break and come back later when it has stopped being naughty.” So that’s what I did!
I came back a couple of hours later and sure enough, the code confessed its wrongdoing. I happened to search for the counter and… uh-oh it incremented itself before the while loop. I ran the program again and it worked like a charm!
What Was the Underlying Issue Though?
See that’s the other thing about programming. By the time you’ve fixed the error, you’re so exhausted that you don’t know why your fix worked. That kind of sucks because it means that you’re bound to repeat the error again and again. Figures.
But instead of talking about all the times I repeated that error, I will put those mistakes in a function and pass over it.
Now Where Were We?
Sometimes you get so lost in the foobars of your code that you forget what you’re trying to make in the first place.
This happened to me when I was designing the aforementioned checkers game. I was working on code to drag and drop the individual pieces, but unfortunately pygame does not make this easy. Here are the steps I had to go through:
- First the checkers pieces wouldn’t budge
- Then multiple pieces were selected
- Finally one piece moves.
- Unfortunately, it also leaves the old circles behind so that any attempt to move a piece leaves a big fat splotch on the board.
I congratulated myself and started to make the splotch a different color each time. Wait… I had brainwashed myself into thinking I was building a coloring game rather than a checkers game!!
Luckily I did not delude myself for long and eventually got around to fixing the underlying issue.
For better or worse, you and I are not Mark Zuckerberg. And coding may be hard. But that doesn’t mean it cannot be rewarding too! If you stick to it and persevere, you will be able to build some very cool projects with code. Here are some that I’ve built:
- An four-function calculator
- An “escape the maze” game
- A virtual food truck
You too can build these games! You just have to stick with it and use your problem solving skills.
Most importantly, believe in yourself and know that there is no problem you cannot solve!
Thank you for reading and be sure to subscribe to our mailing list.