Learning from failure

As you could probably tell from my blog post yesterday, I wasn’t in the highest of spirits about my progress with learning Swift. I decided to spend some time working on my first program to make some of the changes I had been wanting to try.

I failed miserably.

At first, it felt like it had been a complete waste of time. Nothing I tried had worked, and I ended up in the exact same place where I started. But upon further consideration, I realized this is exactly what every programmer goes through at some point. I also reminded myself I have only been doing this for about a month, and shouldn’t have unreasonable expectations. I’ve been reading a few blogs of other programmers and know that even after several years, many people struggle with the same feelings of incompetency.

At each obstacle I face, I’ll have to make a choice: keep going or give up. Since I have chosen a long-term reward mindset, I’m willing to be patient and not expect immediate results. Also, remembering how much time and energy I’ve already invested helps motivate me to continue working.

So, even though it may seem like that time was wasted after failing to make progress, I actually learned more yesterday than I have any other day so far. By practicing with a real program I learned a ton of ways the code will not work.

In programming (as in life), learning what not to do is just as valuable as knowing the correct way, if not more so. The great thing about coding programs is they show you when there’s an error and what it is, so you can diagnose the problem.

If only real life had error messages.