Blog

How to Effectively Learn a New Programming Language

20 Nov, 2023
Xebia Background Header Wave

Learning a new programming language can seem like a daunting task, but with the right approach, it can be a rewarding experience. The process of learning a new programming language shows many similarities with that of learning a spoken language as a second language. Hence, a lot of the learnings for effectively acquiring a second language can be applied to learning a new programming language. In this article I’ll provide some tips to help you effectively learn new programming languages based on well known language acquisition theories.

TL;DR

  1. Ensure a low anxiety, supportive learning environment with comprehensible input
  2. Start with the basics. Some concepts need to be mastered before others can be effectively understood
  3. Use proper resources; Unlearning wrong things is hard!
  4. Practice, practice, practice on your vocabulary
  5. Evaluate your learnings and teach others

What We Can Learn from Language Acquisition Theories

Before we dive into any practical advise with regards to learning new programming languages, let’s have a look at some existing theories around spoken language learning. As it turns out there’s a lot of similarities between effectively learning spoken language and learning a new programming language. In the next paragraph I’ll walk you through a few noteworthy theories and hypotheses around language learning.

Language Acquisition vs Language Learning

Dr. Stephen Krashen, an American linguist, has developed a rather famous theory for second language acquisition. Krashen claims that, despite our individual differences, we all acquire language in the exact same way. We acquire language through messages. We acquire language when we understand what people are saying, not how they are saying it. A key term he’s using for this notion is comprehensible input.

Krashen’s Hypotheses Regarding Language Learning

Krashen developed five hypotheses with regards to language learning.

The first one is the acquisition-learning hypothesis. This hypothesis states that there is a difference between acquiring a language and learning a language. The latter involves consciously studying grammar rules and vocabulary where the former is about subconsciously picking up a language through exposure and immersion, like what is happening when acquiring your first language or mother tongue.

The second hypothesis, the monitor hypothesis, states that the conscious use of grammar rules and vocabulary can only be used to “monitor” language use. That means that before speaking or writing, you “monitor” what you are going to say using your knowledge of spelling, grammar and pronunciation rules. Just after speaking or writing, you use this knowledge to review correctness of what you said or wrote. However, having knowledge of language rules does NOT lead to spontaneous language use.

The third hypothesis is the natural order hypothesis. This hypothesis states that language learners will acquire the rules of a language in a predictable, natural order, regardless of explicit instruction. This implies that attempts to get learners to produce (grammatical) structures before they are ready to do so may fail.

Talking is not practicing. It will not help you speak Spanish out loud in the car as you drive to work in the morning — Stephen Krashen

The fourth hypothesis, the input hypothesis, is about comprehensible input that was mentioned in the beginning of this paragraph. The input hypothesis states that language learners need to be exposed to comprehensible input. As mentioned before, comprehensible input is input that makes a person understand the message. According to Krashen, getting comprehensible input has way more impact on language acquisition than speaking the language. Speaking has a helpful, but indirect contribution to language acquisition. What counts is the “input that you can stimulate from other people”. It’s not what you as a learner say, but what other people say to you. Ideally, the language being used is slightly above the current level of understanding of the learner. This helps that person acquire new language.

Moreover, the language acquisition process does not start with speaking a language. Being able to speak is the result of all the received comprehensible input. An important stage in the language acquisition process is the ‘silent period’. In the silent period, new language learners (not only young children) are relatively silent and hesitant to speak in the target language. Even if learners understand the language to some extent, they’ll typically produce limited verbal output. Being exposed to and immersed in an environment with enough comprehensible input your speaking ability will emerge, gradually.

Krashen’s fifth hypothesis is the affective filter hypothesis, which states that language learners need to have a positive affective (emotional) state in order to acquire language effectively. Learning a language is mostly affected by: motivation, self-esteem & anxiety.

Low motivation, low self-esteem and most of all high anxiety will let the brain put up a filter blocking any (comprehensible) input. This prevents you from acquiring any knowledge.

Other Relevant Language Acquisition Theories

Besides Krashen’s hypotheses for second language acquisition, there are other relevant theories about language acquisition that can be applied to learning programming languages. One such theory is the Cognitive Apprenticeship Theory (CAT), originated by Collins, Brown and Newman. This theory emphasises the importance of learning through guided practice and observation. According to CAT, learning involves a process of “scaffolding,” where learners are gradually given more independence and responsibility as they build their skills and knowledge. Scaffolding consists of temporary support provided by a or more competent peer. Step by step the provided support is tapered off as it becomes unnecessary, much as a scaffold is removed from a building during construction. This way a student is led through the so-called Zone of Proximal Development.

Zone of Proximal Development

The Zone of Proximal Development, a term coined by Soviet psychologist and social constructivist Lev Vygotsky, is defined as the space between what a learner can do without assistance and what a learner can do with guidance or in collaboration with more competent peers. Think of it as learning how to ride a bicycle while you don’t know how to balance your bike or pedal effectively yet. A parent or sibling might help by holding the back of the bike and giving tips while you practice pedalling and steering.

Constructivist & Social Learning Theory

Other theories that prove the importance of learning based on existing knowledge, through collaboration and social interaction are the Constructivist Learning Theory and the Social Learning Theory. The former suggests that learning involves building new knowledge and understanding based on prior knowledge and experience. The latter emphasises the importance of learning through social interaction and collaboration. Every student begins the learning journey with some preexisting knowledge and then continues to build their understanding on top of that. One can say that learning is contextual. We learn by forging connections between what we believe and the information we have already. It’s much harder to learn new things in isolation. Learning is an active process and a social activity. Interacting with others is crucial to constructing knowledge. Learners must actively engage in discussions and (group) activities in order to construct knowledge.

How our Brain Learns New Language

I’ll try to summarise how the above affects our learning with help of the below schema.

How our brain learns schema

To effectively learn a new language we need comprehensible input. This input will be picked up by our sensory memory, ideally through different channels (multifocal input). It helps if we trigger multiple senses, for example by combining audio, video and body movement (e.g. writing or gestures). However, the input will only reach our short-term memory if we have unfiltered attention. That means high motivation, high self-esteem and low anxiety. In our short-term memory we need to retrieve context from our long term memory to forge connections between new information and our current beliefs and understanding. If new knowledge is too far of our current level of understanding (zone of proximal development) or if we need to learn it in isolation it will be very difficult to make those connections and we will experience a very high cognitive load. Transferring new knowledge to our long-term memory requires repetition and practice.

Similarities between learning spoken languages and programming languages

Now what does this all have to do with learning new programming languages? As mentioned before there are many similarities between learning spoken languages and learning programming languages. Understanding these shared characteristics can help leverage language learning skills when approaching programming.

Vocabulary, Syntax and Grammar

As with spoken languages, while learning a new programming language you have to learn a new vocabulary. In spoken languages, this includes words, phrases, and idioms. In programming languages, it includes keywords, functions, variables, and other programming constructs. Both spoken languages and programming languages have their own syntax and grammar rules. In spoken languages, this involves rules for word order, sentence structure, and grammatical constructs. In programming languages, it involves rules for use of keywords, indentation and placement of parentheses and semicolons. Making mistakes and errors are a natural part of the learning process in both cases. In spoken languages, you’ll get feedback on pronunciation or grammar mistakes. While programming, you’ll receive feedback on syntax errors by the compiler and you’ll encounter logic errors and bugs that need to be identified and corrected.

Building blocks, Problem-solving and Practice

Both learning spoken languages and learning new programming languages involve building on foundational knowledge. In spoken languages, you start with basic vocabulary and grammar before moving on to more complex conversations. Similarly, while learning a new programming language you begin with basic concepts and gradually tackle more advanced topics. Problem-solving skills are required in spoken language and coding as well. In the former case, you solve communication challenges and convey your thoughts effectively. In the latter, you solve technical problems and design algorithms. Proficiency in speaking a language or coding in a certain programming language requires regular practice and fluency. The more you use a spoken language or a programming language, the more comfortable and skilled you become in expressing yourself or solving problems.

Cultural context, Adaptation and Evolution

Learning a spoken language often involves understanding the culture associated with that language. Similarly, programming languages are often used within specific development communities or cultures. Each might have their own practices and conventions that you have to get yourself acquainted to. For spoken languages as well as for programming languages, understanding the context is essential for effective communication. In spoken languages, context helps determine the meaning of words and phrases. In programming, understanding the context is crucial for interpreting code and its intended functionality. Besides, languages are not static. They evolve over time. New words, expressions and grammar rules are added to spoken languages, while programming languages receive updates, new features and new best practices.

Applying Language Acquisition Theory to Learning a Programming Language

Now that we’ve established that there are many similarities between spoken languages and programming languages it’d be safe to say that learning a new programming language is like learning a second language. Hence, it’d be helpful to see which of the language acquisition theories discussed earlier we can apply to learning programming languages.

Start with the Basics and Make Connections

Just like in language learning, there is a natural order to learning programming languages, and some concepts need to be mastered before others can be effectively understood. Once you’ve chosen a programming language, start by learning the basics. This includes learning the syntax, data types, variables, and control structures. You can find many online tutorials, videos, learning platforms (e.g. Coursera, Codecadamy) and books that can help you with this. Reading other people’s code is also a great way to learn a new programming language. You can learn from their style, structure, and techniques. You can also learn about common mistakes to avoid. You can find open-source projects on sites like GitHub that you can explore or contribute to. Tip if you want to try out your skills in a small project: filter GitHub issues on the “good first issue” label.

good first issue label search on GitHub

In order to learn a programming language effectively, it’s important to have a good understanding of the fundamentals before moving on to more advanced topics. Try to look for familiar concepts to make it easier for your brain to forge connections with prior knowledge and reduce cognitive load. In the context of programming languages, this could involve connecting new concepts and syntax to existing programming knowledge, while drawing on past experiences with other languages. Many programming languages have constructs for loops, exception handling and working with collections of data. If, for example, I want to learn about Scala’s case classes it is really helpful if I already have an understanding of Java’s record types or Kotlin’s data classes.

Comprehensible, Multifocal Input

However, as the acquisition-learning hypothesis pointed out, the process of learning a language involves acquiring it through immersion and not only by studying. Learning a programming language is no different. Studying syntax and code structure is not enough. Using a programming language correctly involves both understanding the syntax and structure of the language and developing an intuitive sense of how to use it effectively (monitor hypothesis). This will come with practice. Start by writing small programs or with a small project and gradually build up to more complex and larger ones (see also the tip above about the “good first issue” label). It’s important to try out different techniques and experiment with the language. This will give you hands-on experience and help you gain a deeper understanding of how the programming language works.

Although practice is important and will definitely have a positive effect on your skill level, being exposed to as much comprehensible input as possible will even have a bigger impact. In order to learn a programming language effectively, learners need to be exposed to samples of code that are just above their current level of understanding, and gradually build up to more complex examples. You need to be brought into the zone of proximal development.

Copying from StackOverflow or ChatGPT is OK

Comprehensible input is key and is even more effective when we get it through different channels by triggering multiple senses. Reading code or reading about a programming language only triggers one channel. Using a variety of resources, watching videos, talking to other people about code or writing code yourself triggers your sensory memory in different ways, making it more likely new information will stick. It is perfectly fine to rely on code samples from StackOverflow or ChatGPT, but instead of copy-pasting try to type them out yourself. This may sound silly, but because typing is a mental activity that engages most parts of your brain, it helps activate new memory muscles and build more active and strong cognitive connections.

Finding the right (online) resources is important, especially because unlearning wrong things is extremely hard. Nevertheless, since learning is an active process and a social activity, surrounding yourself with (more competent) peers is likely even more effective. Joining online communities can be a great way to learn a new programming language. You can find forums, social media groups, and chat rooms dedicated to different languages. You can ask questions, get feedback on your code, and learn from other people’s experiences. Seeking out mentorship from more experienced programmers, teaching others to reflect on your own understanding or pair programming are also fruitful approaches.

Pair Programming, a Blessing or a Curse?

We have briefly touched upon the positive effects pair programming can have on learning and becoming more fluent in a new programming language. Interacting with others is crucial to constructing knowledge. With pair programming learners must actively engage in discussions and receive continuous feedback. Therefore, pair programming is a great way to further develop your skills.

However, pair programming can also have a negative effect on the learning process. Just like in language learning, learners need to have a positive emotional state in order to effectively learn a programming language. One can be exposed to the very best comprehensible input, but if not in a positive emotional state (e.g. anxiety or low motivation) the affective filter goes up and that input will be blocked by your brain.

Pair programming can be quite daunting, since you are in a mentally vulnerable position, especially when you take the driver’s role. You are being put on the spot and your anxiety levels can go up pretty quickly. In this regard we should consider that the silent period is an important stage in the language acquisition process. Just like learning spoken languages does not start with speaking, acquiring a new programming language does not start with writing code. Language acquisition is the result of all the received comprehensible input. Hence, we should not force learners to start writing code! Respect the silent period. We should be cautious with having new learners pair program. This will only have a positive contribution in a low anxiety environment.

Low Anxiety, Supportive Learning Environment

A low anxiety, supportive learning environment is an environment where participants have high motivation, low anxiety and high self-esteem. Note that the impostor syndrome, the feeling of self-doubt despite possessing skills and experience, is prevalent in many high-skill industries, especially software development. To overcome these challenges, it is important to seek support from peers and mentors, allow yourself to make mistakes, focus on your successes and practice self-compassion. Remember that you are not alone. Many peers feel or have felt the same insecurities that you are feeling. It did not stop them, so don’t let it stop you! Keeping a record of your achievements, such as completed projects or positive feedback from others, can help remind you of your skills and accomplishments.

Conclusion

In conclusion, learning a new programming language takes time and effort, but it can be a rewarding experience. The principles of Krashen’s theory of second language acquisition as well as other spoken language acquisition theories can be applied to learning new programming languages as well. By focusing on both acquiring and learning a language, monitoring your own use of the language, understanding the natural order of learning, seeking out comprehensible input, and maintaining a positive affective state, you can effectively learn a new programming language.

Take a proactive and strategic approach to learning a new programming language. By choosing the right language, starting with the basics, practicing, reading other people’s code, joining online communities, building something, and not being afraid to make mistakes, you can master a new programming language and open up new opportunities in your career.

Jeroen Rosenberg
Dev of the Ops / foodie / speaker / blogger. Founder of @amsscala. Passionate about Agile, Continuous Delivery. Proud father of three.
Questions?

Get in touch with us to learn more about the subject and related solutions

Explore related posts