It always used to amaze me how programmers could pick up new languages without even batting an eye.
Similar to how watching a polyglot flip from Russian to German to Portuguese and everything in between strikes intense amazement, watching a programmer move from one language to another without breaking a sweat offers equal wonderment.
Those programmers always seemed to me to be in another class. I always thought those programmers were just naturally gifted and were those individuals who as students, flew through math and science classes without studying. I always thought I was out of their league.
That is until I began to learn to code.
At the point where it finally clicked for me that no one is born knowing how to code, I finally realized that no one is truly "gifted" when it comes to learning a new programming language. In the end, it all comes down to how you learn and whether or not your learning style is effective.
Become fluent in coding fundamentals.
Once you learn how to code in one language, you pretty much know how to code in all languages. The only difference is the syntax, structure, and conventions. In other words, don’t forget about the basics. Just like how punctuation, sentence structure, and the usage of nouns, pronouns, and verbs, are used in every natural language, so too are lists, if/else statements, for loops, and data types used in (almost) every programming language.
Remember: computational thinking and Coding fundamentals apply to every programming language out there.
Therefore, once you understand how lists, if/else statements, for loops, and data types (among other things) are used in a single language, you’ll be familiar with how they will work in any programming language. The only difference will be in the syntax, the structure, and the conventions that surround them.
If you take one thing away from this article, let it be this: don’t skimp on learning Programming fundamentals.
Code something more meaningful than "Hello World".
A long time ago in a land far away, it became convention, no, tradition, for your first program in a new language to be "Hello World".
While that’s all fine and good when did "Hello World" become the most meaningful first application of a new programming language? Why not do something bold and unexpected? Why not build something that will actually teach you how a new language works?
Instead, make your first program in a new language something meaningful. Now is the time to truly test out what’s under the hood and see how it all works.
The trick is to design a program that gives you a basic understanding of how the language handles fundamental concepts, such as printing out strings, accepting input from a user, storing this input for later use, handling simple algorithms, implement data structures, and handling errors.
This could take the form of a game that becomes smarter as more input is given to it from the user, a program that tries to diagnose your symptoms and becomes more accurate the more symptoms you give it, or a simple blog that offers users more accurate reading recommendations as it receives more input on what the user likes to read.
Learn the language first, the frameworks second.
Programmers, like dogs, can become easily distracted by the next new shiny object (or squirrel) that comes across their path.
This is especially common when the whole reason for learning a new language is to be able to use the frameworks that go along with it. Believe me, I’ve fallen into the same trap.
Frameworks are built on the programming concepts of the languages they belong to. Without knowing the language, you wouldn’t be very familiar with how to use the framework.
For example, say you are presented with a hammer in a country where you don’t speak the language. You have never used a hammer before and you have no idea what it could be used for. A native of that country tries to tell you how to use the hammer, but they’re doing it in their native language. You don’t understand a single bit of the language, so you have no idea how you’re supposed to use the hammer. Short of having the person use the hammer on you so you understand how it works, the next logical step might be to learn a bit of the language so you can understand how to use a hammer.
In other words, you need to learn the language before you can use the tool (the framework).
Strive for understanding, not perfection.
I don’t understand why the world is obsessed with writing perfect code.
Sure, writing the cleanest, most efficient code is definitely something to strive for. However, I think this is where people fall into traps.
Coding, in a lot of ways, is like writing. The problem people have with writing is that they get so caught up with perfection, that they don’t actually get many words or ideas down on the page. The same problem can arise with people coding. Instead of being okay with making mistakes and writing bad code, many will focus the majority of their time on writing the cleanest, shortest, and most effective code possible.
While writing the cleanest, shortest, and most effective code is a fantastic long term goal that everyone should aspire to, it’s not something worth focusing on when learning a new programming language on the fly. For example, it doesn’t make sense to jump right into lambda functions when a method will work perfectly fine. There are a time and a place for lambda functions, but the focus right now should be understanding the basics of the new language.
Striving for perfect code the first time you learn a new programming language would be similar to feeling the need to learn all of your verb conjugations, feminine and masculine nouns, and the sentence structure of a natural language before visiting a new country. In reality, all you need to know is how to say a few simple phrases, a couple of swear words, and have a general understanding of how to read the language so you don’t end up somewhere you shouldn’t. Everyone will understand you, even if you’re speaking the language in a roundabout fashion that isn’t always perfect.
In other words, take the pressure off yourself to write perfect code the first time around when learning a new programming language. There will always be a quicker, shorter way to do something, but that shouldn’t be the focus. Instead, focus on writing bug-free code that runs and gets the job done – especially if you’re learning the language in a hurry. It may not be pretty, but it will still work.
Final thoughts.
This article covers just a few of the tips I’ve used along the way to learn a new programming language on the fly. However, there are several other more conventional tips that I feel I should add to give you the best possible chance at learning a new language quickly:
- Read the documentation. While not all language documentation was created equal, you can get a good idea about the nuts and bolts that come together to make the language you’re learning unique.
- Make sure you’re learning the language for the right reason. If you’re learning the language to get a pay raise, your boss needs you to get a project done in the language, or you will actually be using the language regularly, then congratulations, you’re learning a new programming language for the right reasons!
- Enter into hackathons, Kaggle competitions, and coding challenges. Nothing will force you to solidify your knowledge of a new programming language like a competition.
- Pair program with someone who knows the language well. I’ve often found that learning a new language is best done when you work with someone who knows the language well. Getting to sit and listen to their thought process while they code offers a lot of insight into how the language works and why they are using it in a specific way.
- Use a learning style that works for you. If you are a visual learner, use flow charts, code snippets, mind maps, and videos to better understand a new language. If you’re an auditory learner, use Youtube videos, online courses, or MOOC lectures. If you’re a reading/writing learner, read language documentation, blog posts, website articles, code snippets, and GitHub code repositories. If you’re a kinesthetic learner, follow along with a video and write the code down in your own IDE, or create projects based on source code. Don’t forget that your learning style may change over time. Be open to learning through a variety of methods until you find one that works best for you.
There is no guarantee for learning a new programming language quickly other than persistence and consistency. The unfortunate part is that often when a new language is necessary for your job, there can be an immense amount of pressure to pick up the language quickly. To avoid this pressure, it’s imperative in the tech world to know how you learn best and to play to your strengths when learning something tricky like a new programming language.
Learning a new programming language is a rewarding activity that will not only help you out in your career but will also make you a more well-rounded, reliable, and resourceful coder in the long run.