5 ways to succeed at learning a programming language

A few best practices will help you pick up new programming skills.
632 readers like this.
word learn in chalk on blackboard

Opensource.com

Whether you're taking up programming for the first time, or learning your 50th language, you might ask, "What's the best way to learn to program?" I surveyed dozens of people who taught themselves to program in Rust as part of my OSCON talk in 2016, and asked the expert autodidacts what advice they would give to others for picking up a new language. I found that despite their diverse backgrounds, all of my interviewees shared five common approaches to building new programming skills.

1. Learn by doing.

Predicting what will happen when your code runs is, perhaps, the essence of programming. The best way to find out what will happen when a piece of code gets modified is to run it before and after that change, and compare the results.

Learning by doing will also help you hone your troubleshooting skills. If you're able to run the code you're studying at each step of a tutorial, you can easily guess how a modification will change its behavior and then check whether you were correct. Predicting your language's behavior is the essence of programming: You decide what you want your program to do, write code that you predict will have that result, and then run it to see whether you were right.

2. Practice consistently.

You already know that frequent practice is essential to cultivating any new skill. But did you know that it's even more important if the new thing you're learning involves software? Because programming languages and the tools around them are constantly being improved, part of your study time will go to simply keeping up with your new language and ecosystem's news and developments.

Additionally, practice consistently by using only a single major version of your new language until you're confident in your grasp of its basic concepts. The best practices for accomplishing a given task often change as new language features are added. This means that if you jump around between major versions of a language, you'll have to process conflicting advice about when to use the language's various features, as well as trying to learn them! While it's certainly possible to end up fluent in the language even if you study many different versions of it and its tools at first, the added complexity will slow your progress.

3. Start with the basics.

Letting a kid try to ride a motorcycle before they can balance on a bike is just setting them up for failure. Similarly, jumping into tasks that require skills you haven't developed yet is a great way to set yourself up for an extremely frustrating experience in a new language.

If you're learning from a book or tutorial, choose one that's written for students at or below your own level of experience. When you're brand new to programming, the amount of new material can seem overwhelming. But learning subsequent languages will be simpler, because you'll already understand the basic concepts like variable assignment, comparison, and control flow.

Before you try to write an entire application from scratch, start with the basics by acquainting yourself with the language, its package manager, and the editor plugins and testing tools that you'll need.

4. Respect languages' differences.

Many languages have idiomatic patterns to how people code in them. Although forcing your old language's idioms onto code in your new language is possible, you should try to learn to have a more flexible coding style. Writing code with the "nature" of your new language will make it easier for others to read, critique, and help you improve.

You can learn your new language's idioms by reading popular open source code written in it, and explore their philosophies by reading blog posts and articles by experts. As you progress, consider asking a more expert programmer to review your code and offer feedback on how easy it is to read.

If a unique feature or idiom of your new language doesn't make sense to you, don't be afraid to ask about it. You'll get the best answers by asking respectfully and without judgment. "I'm new to this language, and I noticed that everyone seems to do X instead of Y. Where could I learn the story behind that pattern?" will probably get you a fascinating historical anecdote, whereas "X makes no sense, you should do Y instead" is likely to elicit an equally intolerant response.

5. Build something you love.

You don't have to build the same toy project as a book or tutorial just because an expert suggested it. If you're building some code just to learn a language, it could be anything. Choosing a project that interests and delights you can help motivate you to spend more time on your learning, imagine and ask better questions, and keep pushing forward when you encounter challenges.

Do you have other suggestions for success when learning a new language? Let us know about them in the comments.

User profile image.
E. Dunham is an open source geek of many trades, currently working as a "DevOps" Engineer for Mozilla Research. This role has applied skills learned at the OSU Open Source Lab and a variety of other companies to improving the Rust programming language's tools and infrastructure. Other hobbies include writing, gardening, and enjoying Oregon's outdoors.

2 Comments

I agree with all of this. What I might add to point 5 is to make something you would use or need on some regular basis. Convert some process you are now doing manually into a semiautomated or automatic process.
Another aspect is to look for the intellectually intriguing. It might not be something you need or need frequently, but some problems are intellectually interesting -- "I wonder if I could write a program to do this ...." What you find later is that you may be able to use these as part of some bigger task, once you see how this fits in with other things you have written.

This is a really great article. If someone is beginning to learn a programming language, he/she must also be patient. Also, I try recursive searching so I can fully comprehend what's going on with the code.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.