Getting better at programming

Last month I wrote an article giving advice for those getting started with programming, the conclusion being: you learn by doing. In this post I want to focus on how to get better.

Work to failure

When I'm not a geeking it out behind a computer, I'm training in the gym: I love weight training almost as much as I love programming. There's a term used in weight training to describe how a workout should be performed to maximise its benefits: work to failure.

In everyday life the idea of failing at something has a negative connotation: it implies that you're not good enough, that you've let yourself down. That you're a failure.

In weight training and many other sports, however, it's seen as a vital platform for growth. If you don't allow your body to reach failure there's no incentive for change. In order to grow, to become bigger and stronger, you have to push your body past its limits.

And programming is the same.

Everyone has areas of programming they struggle with. For some it's object oriented design, for others it's functional programming; for many it's pointers. When you struggle to understand a concept you feel awful and naturally try to avoid the cause, but by doing this, you're missing out on a great opportunity to learn. It's just going to take a while.

For example, I used to find it difficult to complete large projects. Small libraries and tools were easy, but large, complex projects were always a struggle, and would often end in me giving up. I reached failure, but didn't work past it. Through focusing large on complex projects, working through the failure, I'm now able to work effectively on large projects with confidence. I've grown.

Learn to recognise areas of programming that you find difficult and naturally want to avoid, and dedicate time to learning. Let yourself fail. Then through blood, sweat, and tears, work past the failure until the solution comes naturally to you.

Help others on StackOverflow

StackOverflow is a revolution. It is the go-to website for help with any programming problem.

It can also be used to get better at programming. Pick an unanswered question and try to solve it. You can filter the list to show only unanswered questions in the languages you're interested in.

Keep in mind that the focus is on learning through helping, not scoring points. Don't rush to an answer because you want to win at the StackOverflow game. Even if someone else has answered the question before you, take your time. You can even compare answers. Perhaps your solution isn't the best, but you can be sure that you will learn from the experience.

Helping on StackOverflow is a win-win. You learn a new aspect of programming and how to communicate an idea effectively, and someone else has a problem solved.

Contribute to an open source project

If you've spent most of your time writing your own projects, perhaps contributing to an open source project will help improve your skills.

Learning to read code written by another programmer is an important skill. Every programmer has their own style. Where one programmer uses a ternary conditional expression, another might use a standard if/else. The more you expose yourself to other people's code and style, the more you will be able to instinctively see the intention behind it.

Contributing to an open source project also exposes you to working with other developers. Collaboration is a great way to learn from other, perhaps more talented, programmers. It's also a great opportunity to improve vital communication skills.

Finding a project to contribute to is really simple. You can search GitHub issues with the Help Wanted label. At the time of writing there are 33,662 issues that require help. The list can also be filtered further based on your preferred language.

Banner image Hardcore Stormies Hit The Gym by W_Minshull. Licensed under CC BY 2.0. Changes were made to the original.
Author image
Creator of Humble Coder and serial hobbyist