top of page

Learn How to Code: Insights from the L2 Motivational Self System


Listen. Let’s just say this one thing out loud:

Learning how to code is hard.

Anybody whotells you that learning how to code is not hard is either lying to boost their own egos, or they’ve been coding since they were four and don’t actually remember what it felt like to learn how to code.

Learning how to code requires time, doggedness, deep concentration, ceaseless solicitations for help, and the ability to endure over and over again tiny but innumerable failures.

But let’s say this out loud, too: Learning how to code is achievable. And you don’t have to hand over two to four years of your life – and tens of thousands of dollars – for a computer science degree to do it. In 2016, after having seen enough evidence that a person could get hired to write code after a six month immersive bootcamp, I myself decided to learn how to code. And after those (brutal) six months of immersion, I did get hired to write code.

I’l be honest: For awhile after graduating from my bootcamp, I believed we bootcampers could never stack up to our C.S. degree-holding colleagues. In fact, some of the most effective engineers I’ve worked with over the last six years have been either self-taught or bootcamp graduates.

So, yeah. Learning how to code is hard, but learning how to code is also achievable.

A lot of folks give up on learning how to code, though, some before they’ve even really begun. What makes the difference between those who give up, then, and those who persist through the challenge to eventually become software developers or engineers? We’ll never reduce this down to a simple answer, of course; myriad complex and unique factors both help and hinder any individual’s attempt to learn anything. But I think we can begin to find some partial explanations for why folks persist in learning how to code by looking to theories of second and foreign language learning and acquisition.

A second or foreign language is one that a person learns in addition to their native language(s), after early childhood. If you study a language in your native-language context (e.g., you’re studying Icelandic in preparation for a trip to Iceland), it is considered a “foreign” language, while a language studied in a context where that language is one of the dominant languages makes it a “second” language. For the sake of concision, I’ll use “foreign language” to refer to both henceforth in this article.

Previously, I’ve written about the numerous analogies between learning human languages and learning programming languages, specifically through the lens of Second Language Acquisition (SLA) research. SLA is a branch of applied linguistics in which researchers investigate the factors that support, accelerate and impede the learning and ultimate acquisition of foreign languages. It’s required curriculum for anyone studying for a Master’s degree in foreign language teaching. Filled with fascinating hypotheses and research, SLA was hands-down my favorite focus area in graduate school, and one that has fundamentally changed the way I think about learning both natural and programming languages.

In this piece, I want to focus on a tiny slice of the SLA ecosystem by exploring a theory called the L2 Motivational Self System. I think that this theory can help explain why some folks persist through the challenges of learning how to code, while some ultimately give up.

In SLA research, “L2” is an acronym used to refer generally to a foreign language someone is trying to learn. This is also sometimes called the “target language”, and is distinguished from the “native” language(s) learned in early childhood.

First, we’ll look at the theory in its home context – foreign language learning – and then explore ways in which aspiring software developers might harness it to propel their learning and acquisition of programming languages.

The L2 Motivational Self System

In 2005, Zoltán Dörnyei introduced the L2 Motivational Self System (L2MSS). Dörnyei is a professor of psycholinguistics, well-known in the SLA community for his work on language learning motivation.

According to Dörnyei (2019), the L2MSS “was partly the outcome of empirical research conducted in Hungary and partly of theoretical advances in the fields of applied linguistics and psychology,” and since its introduction, the L2MSS has received outsize attention and support from the SLA research community. In fact, in 2015, Dörnyei and colleagues reported that a survey of recent publications indicated that the L2MSS was the most heavily researched L2 motivation framework at that time.

While a graduate student, I mustered the courage to approach Dörnyei at the 2013 American Association of Applied Linguistics Conference to ask him to sign my personal copy of his book. I was positively starstruck!

The system comprises three dimensions that, according to Dörnyei, help to explain why some learners persist (and eventually succeed) in language learning, while others do not:

  • the Ideal L2 Self

  • the Ought-to L2 Self

  • the L2 Learning Experience

In this piece, we’re going to focus on the Ideal and Ought-to selves. Let’s take a look at how these two “imagined selves” have been theorized to propel human language learning.

The Ideal L2 Self

The Ideal L2 Self is the learner's image of their future self as a person using the target language, in the context in which they wish to use it, and at the proficiency at which they wish to use it. Basically, this image represents the language user they aspire to become. Important to this idealized self is the idea of self-actualization – the learner’s motivation here is highly internal – and the idea is that this image motivates the learner as they work to close the gap between their “actual” self and their “ideal” self.

How does the Ideal L2 Self manifest in foreign language learning? Following are just a few examples that I’ve encountered through my personal travels and time as an English language instructor:

  • The native-Japanese speaking literature student who dreams of a career in translating works of contemporary Japanese fiction into Arabic for middle-eastern audiences; he is highly motivated to achieve expert proficiency in Arabic by an image of himself spending his life immersed in literature, and bringing his home country’s literature to another culture.

  • The traveler who dreams of backpacking through South America and having substantive conversations about past and present Latin American politics with Spanish-speaking locals; she imagines herself engaging in the types of conversations that require intermediate Spanish proficiency.

  • The Canadian-born descendent of Croatian immigrants who dreams of living and working in Croatia and having meaningful conversations with extended family members in their native language; she is motivated to gain intermediate Croatian proficiency before her move, knowing she will have opportunities to progress to advanced proficiency once in a Croatian-speaking context.

These learners of Arabic, Spanish and Croatian are each motivated by their ideal image of themselves using their target languages in a specific “dream” context, for a specific “dream” purpose. These learners don’t need to learn their target language; they want to. Keeping these self-idealizing images front of mind as they move through the incredibly challenging task of gaining proficiency in a foreign language helps to keep them motivated and persistent as they work toward their goal.

The Ought-to L2 Self

The Ought-to L2 Self is the learner's image of what language skills they ought to possess, either now or in the future. This image represents the language user the learner believes they are required or compelled to become, typically by external sources. The Ought-to L2 Self is theorized to motivate the learner primarily through avoidance of negative outcomes.

Following are a few examples of how the Ought-to L2 Self has motivated folks to persist in language learning:

  • The high school student working towards an “A” grade in an intermediate German class in order to not only satisfy a graduation requirement, but also to secure her place as class valedictorian, which her parents have put pressure on her to achieve; she has no inherent interest in German, and does not plan to use it once she has completed her course.

  • The Afghani restaurant owner motivated to learn business terminology and conversational phrases in English in order to more easily operate a restaurant in an American city; owning this restaurant is not his dream - he was a medical doctor back in Baghdad - but he feels to succeed in making a new life here with his family, he should increase his English proficiency.

  • The South Korean English instructor whose university has sponsored her to study English linguistics at a American university so that she can teach advanced English courses to Korean students in Seoul; she has no special interest in or passion for English – gaining this mastery of the language is purely utilitarian and dictated by her employer.

Applications to Learning to Code

How might images of the ideal and ought-to selves impact persistence and ultimate acquisition in learning how to code? Let’s look at some examples.

We’ll define the Ideal Coding Self as the coding language learner's image of their future self as a person using that programming language, in the context in which they wish to use it, at the proficiency at which they wish to use it.

The Ideal Coding Self

  • The ultra-runner who dreams of working a flexible job that allows her to work remotely (and thus live in the mountains, close to ideal training grounds), organize her working schedule around her training schedule, and make enough money to travel frequently to races both domestic and abroad; she has multiple running friends who are software engineers and living this life, and this ideal image of herself is modeled after these friends.

  • The product manager who – after a decade of determining what software engineers build – dreams of building the software himself through code; he imagines himself as a unicorn software engineer – one who possesses not only the technical skills to build software, but also a deep understanding of product and process, which he believes will make him a highly effective engineer.

  • The newly-married woman who far under-earns her software-engineer husband, despite having an advanced degree and strong work ethic; she dreams of realizing her professional potential through transitioning into a career in software development and eventually becoming the household breadwinner.

Next, let’s define the Ought-to Coding Self as the learner's image of their future self with the coding skills they ought to possess in order to become the person or professional they feel they ought to become.

The Ought-to Coding Self

  • The over-worked, under-paid adjunct instructor who is learning to code in the evenings in hopes of joining a local software company; he loves teaching, and has no inherent interest in technology and programming, but recognizes that his current knowledge and work is worth more than he’s being paid, and that his lifetime earning potential (and financial security) is limited by staying in his current profession.

  • The university freshman who is majoring in computer science, learning Python and Java, because she thinks she should pursue a career that holds high earning potential; her dream is to become an artist, but she is not willing to take the risk of pursuing that career path, knowing that the financial rewards are not guaranteed.

  • The under-employed horse trainer who is learning Jacascript in the evenings in order to gain admittance to a Full Stack Web Development bootcamp; though he loves spending his days training horses, he recognizes that as the father of small children, he needs to find a safer, more reliable, and better-paying vocation in order to support his family.

Action Items

To my knowledge, Dornyei’s L2MSS has never been tested in a programming language learning context, and so any proposals I make here about the applicability of the theory need to be understood as pure theorizing. Despite this lack of empirical validation, though, I don’t think it can hurt to apply some takeaways for those who are thinking about learning how to code.

First, take some time to imagine your ideal coding self. Do you imagine yourself as the innovative tech entrepreneur who writes code alongside your startup engineering team to build the world’s next killer app? Do you desire to volunteer your free time to contribute code to important open-source software, or to non-profit organizations that rely on volunteer programmers? Can you picture a life in which you work from wherever you want, on your own schedule, with a salary that allows you to both save for retirement and have a little fun now and then? Once you have an image of your ideal coding self or selves, harness it to sustain your motivation as you learn how to code.

Take some time, too, to imagine your ought-to coding self. The image of what you should be doing, or need to be doing, can be as strong a motivator as that image of the ideal self, and for some, it can be an even stronger motivator. Do you need to work in a flexible position in order to care for a loved one, and believe that becoming a Python engineer can provide you that? Do you believe you ought to achieve financial independence so that you can stop relying on your parents for help paying your bills, and know that software developers can make six figures in entry-level roles? Use the image of your ought-to coding self along with that of your ideal coding self.


In sum, the L2MSS proposes that images of the ideal and ought-to selves are effective motivators in persisting through the challenging processes of learning and acquisition. These images are not mutually exclusive – no learner is motivated by only images of their ideal self, just as no learner is motivated by only images of their ought-to self. I myself have always been motivated by multiple ideal images, and multiple ought-to images of my coding-self, both at the beginning of my learning journey, as well as now, as I work toward gaining senior-level Python proficiency.

While it’s important to keep in mind that motivation is nowhere near the only factor that can help or hinder your success in learning how to code, I do believe that it’s worth the effort to imagine your ideal and ought-to selves, so that you can harness those images to sustain your motivation as you engage in the hard – but remember: achievable – task of learning how to code.

So do the work in figuring out what your motivations are, and keep them top of mind as you progress through this journey. You’ve got this, friends. I’m cheering for you!

Bibliography & Suggested Reading

Al-Hoorie, Ali H. (2018). The L2 motivational self system: A meta-analysis. Studies in Second Language Learning and Teaching. 8 (4). 721–754.

Bobkina, Jelena, et al. (2021). “Why Am I Learning English? Spanish EFL Sports Science University Students’ Motivational Orientations through the Prism of the L2 Motivational Self System.” Studies in second language learning and teaching 11(4). 543–578.

Dörnyei, Z. (2005). The psychology of the language learner: Individual differences in second language acquisition. Mahwah, NJ: Lawrence Erlbaum.

Dörnyei, Z. (2009). The L2 Motivational Self System. In Z. Dörnyei, & E. Ushioda (Eds.), Motivation, language identity and the L2 self (pp. 9-42). Bristol: Multilingual Matters.

Dörnyei, Z. (2019). Towards a better understanding of the L2 Learning Experience, the Cinderella of the L2 Motivational Self System. Studies in Second Language Learning and Teaching. 9 (1). 19-30

Gass, S. (2020). Second language acquisition: An Introductory course. Routledge.


bottom of page