How to Best Learn a New Programming Language
Learning a new programming language is undeniably a daunting experience for even the most adept developer. You may have been in the coding game for a few weeks or perhaps even a decade, either way when you take a first glance at the source code of a language you’re unfamiliar with, a sense of confusion will no doubt make its way across your mind. Luckily, all languages can be learnt with time and practice. For experienced developers who have been doing it for a long time, the process of learning new languages gradually become less daunting. Similar patterns of learning evolve that help you pick up new languages, or frameworks, at a faster pace. Today I will share with you my tried and tested process that I have established over a 13-year career as a software engineer.
Why Learn This Language?
One of the first steps you need to take is to answer the question ‘why are you learning this language?’ It’s not as simple as “because my work needs me to”. No, what you want to find out is why this language has been created in the first place. What problems were the engineers trying to solve when designing this language? What advantages does it have over other similar languages? These are important questions, as answering these will give you context as to where your learning efforts will take you, and what advantage you can exploit by becoming proficient in this particular language.
Start With The Basics
Once you’ve answered this first question, it’s time to get your feet wet and start learning the basics. This should involve reading the Getting Started and Basic Syntax sections of the language documentation. All reputable languages will cover these two sections in their docs — or at least chapters with similar titles. What I like to do is create a very simple app, often just a console app which calculates the sum of two input numbers. If your framework is geared completely towards web or mobile development, then you may need to create a simple web page or mobile view — just make sure you keep it as simple as the infamous “hello world” exercise. Getting this app up and running from scratch can be a task in itself, but it will help you understand how to setup and install the language on a new machine.
Once it’s up and running, read through each of the basic syntax structures, features and concepts, and try each at least once. This might involve modifying your app to accept a number instead of a string as input, and using a ‘for’ loop to output multiples of that input into the console view. The important thing is to give yourself time to let the basics sink in before moving on — it’s easy to over extend yourself early on, and this can cause you to become overwhelmed and bewildered.
Now Take Your Next Steps
When you have the basics down pat, it’s time to start introducing yourself to the next concepts. Continue to follow the provided documentation, one topic at a time. Experiment by adding logic to the basic app you created earlier. This app should essentially be acting as a scratch pad for your learning. Don’t worry that you might be adding a class where it’s not necessary, you just want to be familiarizing yourself with each building block at the moment. Often, I make an app that uses at least one instance of each component that I’ve learned. A lot of the logic is commented out later on to make room for more code, but I will still keep it there as a reference. Stay aware from any section labelled “Advanced” at this point though, this will come later.
Putting What You’ve Learnt so Far Into Practice
Having familiarised yourself with the basic and core features of the language, it is now time to start bringing it all together. Think up an idea for a relatively simple new app, or an existing app that you are happy to reproduce. This app should be more complex than your first one and should serve some sort of purpose. Some examples might be a calculator tool or a step-by-step form/wizard. With the building blocks fresh in your mind, write down and sketch on paper how you plan on structuring the app, identifying which features you’ll use and where. Set up the folder structure and look at tutorials and example projects to see how those apps are typically structured. Make sure you nail this solution design and architecture before you start filling in the gaps with code.
Divide and Conquer
It’s time to bring your app to life. Employ the divide and conquer strategy by working on one area or component at a time. Reference the syntax you wrote in your first app, and leverage the abundance of information and examples available on the forums online. Stack Overflow is my favourite for this by far! As you work through filling in the gaps in your app, the individual concepts that you learnt earlier on will start to make even more sense. You will even begin to understand through your own experience the answer to the question you asked at the start of your journey. Your app will slowly but surely start coming together, and with it your understanding of this language as a whole.
Daniel Boterhoven is a seasoned Software Engineer and Lead Developer at Viewport Tech, a web and mobile app development consultancy that specialises in projects for SMB and Startups.
Originally published at coderacademy.edu.au.