Failure is not what you think it is

We have been taught about failure all wrong.

Halim Shams
6 min readJul 7, 2024
An Article by — Halim Shams

When it comes to programming, we all know that it’s full of failures. In fact, this specific field is the only one on planet Earth with the most failures, and quite surprisingly, the failures never come to an end until YOU put an end to them.

There isn’t any way to not face bugs in your code; you’ll encounter bugs whenever you’re programming, and you have to find them and kill them, or let them stay there for the rest of their lives until you remove the entire project directory from your machine.

I remember when I spent my entire day debugging. I haven’t even written or added a single line of code; all I did was find that bug in my project and get rid of it. It was so frustrating because I spent my entire day, stayed up late, and still couldn’t figure it out. There weren’t any bugs, but there was a single, incredibly annoying bug.

I assumed my entire day was a wasted day when I got into bed. I even cried as I skipped some of my most crucial daily tasks (gym, course lessons, writing, and spending time with family) to figure out the bug in my code. I cried because these tasks are at the top of my to-do list, and I don’t feel fulfilled at the end of the day, even if I miss one of these crucial activities.

The following day, I woke up paralyzed due to the lack of sleep but strongly decided not to miss any of those important daily tasks at any cost again. During lifting weights, all I was thinking about was yesterday’s bug. I was figuring out how to get rid of it in the gym while lifting weights.

I didn’t bring my headphones to the gym that day as usual because I was extremely upset, and there was a sense of guilt about listening to music when you’ve done nothing useful or missed your most important tasks of the day.

I enjoy listening to music when I’m happy; otherwise, I hate listening to music when I’m feeling blue.

In the middle of the exercise, as I was literally reading and compiling my entire project’s code line by line in my mind — the functions, the value each function returns — there was this struck and A-Ha moment that I immediately dropped the dumbbells and left the gym to get rid of that sucker in my code. I tried that approach; I got zero errors, and the project was back on track. There are no words that come to mind to describe the moment I ran the code and it worked.

Getting rid of that bug helped me save time whenever again I encountered the same bug in my future projects because I was familiar with it and I knew the secret to solving it.

Debugging is not a waste of time; giving up on a bug is a true waste of time.

I could just leave it for good, not thinking about the bug. I could just put my headphones on, listen to high-beat music, and never bother regretting yesterday’s time. But I couldn’t ignore that wasted day, and the only way to turn that wasted day into a productive one and bring me happiness was to solve the issue with the project. This wasn’t just a normal random project; it was something I’ve been dreaming of and wanted to bring to reality, so even if I abandoned that project and never thought about it, there would still be chances to get back to it and turn that idea into reality.

Imagine not figuring it out; I could encounter the same bug many, many times again — as I did encounter it — and then leave it in the middle and not bother even thinking about it because it had no solution, which is a real waste of time.

Spending time vs. Wasting time

You’ll never be able to code your dream project just by watching 50+ hours of bootcamps; it’s impossible to learn anything without doing it yourself and recovering from the inevitable failures.

You can’t learn to play soccer by reading the rulebook; you can’t learn to play piano by studying sheets of music; and you can’t learn to cook by reading a cookbook.

Exclusive for My Audience!

Exclusive content for passionate programmers! Subscribe to our newsletter for tips, hacks, and advice that will transform your coding journey.

Subscribe now!

Have you ever seen a crawling baby immediately stand up and walk like an adult? — Hell no, that can only be possible in a heart-stopping horror movie. — They fail. They fall down many times; they try standing again; they don’t stop it; they may even get hurt, but they don’t stop and try standing again; they use these failures as a lesson; once they fall down and get hurt, they don’t repeat the mistake that caused them to fall down again, and as a result of keeping up with this process, they master standing up.

Failures offer learning opportunities and increase the chances that you won’t make the same mistake again.

How to treat failure?

We are used to measuring failure or success by the outcome, not the effort. You have to fail. In fact, when you fail, be glad about it. Every time you fail, you’re one step closer.

Next time you fail, say, “Hell yeah! got that sucker out of the way.” Go to the next one, fail again, “OK, I got two out of the way.

Your approach doesn’t have to be perfect for it to succeed. Remember, the world isn’t run by perfect people who never fail. The world is run by imperfect people who have failed over and over again.

What is going to happen is that if you keep this up, you’re embracing failure, and as a result, there won’t be anything left in your course; you’ve already swung through all the obstacles, and now your path is crystal-clear. You just need to take the next step.

If you treat failure like a full stop, you’re dead; if you treat failure like a comma, you’re good to go.

Quitting before the final push to success.

I’ve seen many people give up at this time. After tolerating several failures, they think that it’s not going to work out, and they give up for good. However, the real failure lies in giving up is right when all the obstacles are overcome. It’s like running a marathon and quitting just a few meters before the finish line, which is kind of disloyalty to yourself.

Maybe that failure you just experienced isn’t the end after all; maybe it’s the starting point. Every time I feel like giving up, there’s this Jack Ma’s quote that pops up in my mind:

Today is difficult, tomorrow is much more difficult, but the day after tomorrow is beautiful; Most people die tomorrow evening.

That’s all for this article. If you find it useful, don’t forget to share it with your fellow developers as well.

Don’t forget to subscribe to my exclusive newsletter for My Audience: 👇

— You can follow me on X (formerly Twitter) or LinkedIn as well, where I’ll share short and incredible stuffs out there, so don’t miss those. 🚀

Buy me a Coffee

--

--

Halim Shams

I Write about Programming and All the Related Content 🚀 I'm a Self-Taught Full-Stack Developer 💛