We all have been there; trying to learn something new. But how? No matter what you are learning, it always comes down to a few key aspects. This article will break down some of the most proven techniques to learn a new programming language.
How to learn
Not everyone learns well the same way. For some, learning something new might work best if they read about it, for others it might be by watching a video tutorial or listening to a podcast - you should know best what has worked for you in the past.
Your first step will be to find resources for your way of learning. Here some of the wider spread approaches to learning and some advice and suggestions for each.
In my experience, reading books is one of the best ways to get information about a certain topic. The reason, I believe so, is because writing a book takes some time and effort; the overall quality in the end is better and more conclusive than resources you tend to find on the internet.
Note: Are you learning your first language? Have you decided yet what language it should be? If not, I advise you to read my other article Becoming a software engineer: Choosing your first programming language. This will give you a good idea on what you could learn.
Besides that, when you are struggling to understand something, need advice on a certain topic or want an opinion about your latest design: the best sources to finding answers on programming is StackOverflow. Here an extract from their about page:
Founded in 2008, Stack Overflow is the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. More than 50 million professional and aspiring programmers visit Stack Overflow each month to help solve coding problems, develop new skills, and find job opportunities.
StackOverflow provides you with a huge database of high-quality answers to all different topics. If you need help, check out StackOverflow first, it is likely that the same or similar questions have been asked and answered before. The StackExchange network further provides specific forums for Software Engineering, Code Reviews and Programming Puzzles & Code Golf for the ones interested.
Yet another fantastic source is Reddit with a lot of great content and an active community to help you get started. They also offer several sub-threads regarding programming; Learn programming, Programming Languages and Ask Programming are just a few examples.
The official documentations for a language, framework or library can provide you with very detailed information about a certain implementation. This might be especially useful if one is trying to solve a problem with an unusual use-case; tutorials and example resources might be rare in this case - you must know how to find the information yourself.
Videos are a great way to get a lot of information in a compressed form. There exist a lot of really great and detailed videos for learning a new programming language, both for free on YouTube or as complete courses on Skillshare. You can sign up now to get 2 month premium for free on Skillshare using the following link:
Furthermore, you can find lots of great tutorials on hackr.io, Udemy and Coursera - just to mention a few. Regardless your prior knowledge, I am pretty sure you will find something suiting your skill-level.
There are fewer, but still some resources available which provide you with an interactive learning experience. I am a big fan of learning by doing, here are some sites I can recommend:
These sites cover a wide spectrum of content; from beginner tutorials, on how to deal with edge case problems to very advanced problems solving techniques.
What to learn
Knowing more than one programming language will give you an advantage because you will more often than not find similarities between different languages. The following sections will cover different approaches on what you should learn for both beginners, as well as for more advanced software developers.
As a general advice for everyone:
The single most important thing when learning something new is to practice it. This means you have to write code, write code and write even more code! It all comes down to using your acquired skills - practice makes perfect. I advise you to write code as you are learning new concepts, always testing yourself to see if you understand the principal before moving on.
As a beginner
This section is for those who just started learning programming and have no prior knowledge at all. Now that you know where to find resources regarding programming from the previous section in this post, you are probably wondering what you should learn first of your chosen language.
It is somewhat a tradition to start the journey of learning a new language by writing a
“Hello World” program.
The goal is to successfully setup a project, start the application and output
Hello World to the screen. There are
lot of great beginner tutorials out there explaining how to setup your development environment, setup your project
properly and write your first Hello World program in your desired language. These are the first steps you should make.
A few words regarding your development environment; You will most likely be working with one or more different tools to develop your software. Since code is basically just text, one of the more important tools you will need is a text editor. The easiest way is to use one of the many different IDEs (Integrated development environment). An IDE is basically a more advanced text editor with features like syntax highlighting to be able to read code more easily, intelligent code completion for a faster and more reliable coding experience, as well as build tools which allow you to build and start your project. It provides you with all you need to get started. If you are learning one of my recommended programming languages for beginners C# or Java, I would suggest you use Visual Studio Community for C# and IntelliJ IDEA Community for Java respectively. They are both free, offer a great toolset and come with an intuitive user interface to get you started.
Once you have your project up and running you can start learning the different concepts. Look out for tutorials, blog posts and guides covering the following topics:
- Data types
- Control statements
- Methods ..also referred to as Functions or Subroutines
These are the most fundamental building blocks of your program when using a strong typed programming language like C# or Java. They help you structure your code, sequence your logic and perform actions like you expect them to.
Note: Not all programming languages are built for the same purpose, some may be based on different core principals. You should definitely check if these concepts apply for your chosen language, if you decided for a different one than the ones mentioned before.
As a more experienced developer
The first language is always the hardest to learn, it will only become easier as you learn more languages. There are a lot of similarities between different programming languages. As an example, the idea of a for loop is the same, regardless if you are using one in C#, Java or Python. This makes it a lot easier to get started with a new language, requiring you only to adapt to new code syntax and culture of the language. Always seeking for knowledge and further educating yourself in new areas will help you widen your horizon.
A great way to get an impression on the new syntax is by looking at some sample code written in the language you want to learn. GitHub can be a great place to find projects in all variants and sizes.
To get up and running as fast as possible, most languages provide some sort of quick starter guide. You can also find some great videos available online covering a great portion of a language in a short amount of time. After watching a video like this you might not be able to code in the new language just yet, but you should definitely have a better understanding of the overall way of using it.
Once you understand the new syntax and you have familiarized yourself with the ecosystem and culture of the new language, there is not much else you can do besides practice writing code in your new language. Once you have a solid understanding of the basics it is time to take a look at some more advanced practices. The following list includes a few topics you could consider:
- Inheritance & interfaces
- Threads & Concurrency
- Space- & Time-complexity
- Programming paradigms
- Design patterns & Best coding practices
- Software testing & Test automation
Your research does not always have to be language specific. Programming can be much more than just a tool to solve a problem; For me, writing good, clean and elegant code is art. What is considered good practice will in many languages somewhat be the same thing. Things like choosing meaningful and short variable and method names, writing comments where necessary and testing your code are just a few examples. I have read quite a few books on programming and good practices in the past, here are some I personally can recommend:
Learning to program is a process which can take a long time to master. Be patient, practice your skills and seek for knowledge to further educate yourself on the way to becoming a pro. The internet is full of helpful resources; you can find anything from the very basics to highly advanced concepts. Learn how to find the resources you are looking for. Most importantly: write code!
Thanks for reading this article. I hope you found this helpful. Share your feedback and experience in the comments and subscribe for more content on fooo.ooo.