A great deal of academic ink has been spilled about how novices learn programming languages. This is important for educators teaching introductory programming, but for the most part we have failed to ask much about how those students learn languages later. Conventional wisdom is that expertise in programming is highly transferrable from one language to another—so much so that professors and bosses alike routinely expect programmers to pick up a new language by themselves, as required for their class or job. Because new languages continue to emerge, and developers want to leverage their expertise in new settings, learning new languages is a lifelong occupation. What if it is not as easy as we have always assumed?
In the following paper, Shrestha et al. explore this question, and report that learning new languages can be quite difficult, even for programming experts! To make the task easier, developers try applying knowledge about programming languages they know well to a language they are learning. This works often enough to be useful, but it can also lead them astray. In an empirical study of Stack Overflow, the authors identify several situations where programmers ended up with misconceptions about new languages based on incorrectly transferring ideas from languages they know. The paper elegantly frames this in terms of psychology and neuroscience theory, which suggests that old knowledge can either facilitate learning new knowledge or interfere with it.
To understand the source of these difficulties, the authors conduct a series of interviews with expert developers who are learning new languages. The results provide insight into the nature of the problem and suggest paths forward to addressing it. One notable observation is that programmers create a mental map, constructed on demand, from features of the language they are learning to languages they already know.
This is an exciting insight, partly because it helps us understand how expert developers work, but also because it points to ways to support developers in learning those mappings. For example, the paper suggests that texts and other documentation focused on learning programming languages could be organized around mappings, showing how coding techniques in one language can be translated to another. Similarly, the authors discuss tools that look for errors that reflect usage in the programmer's original language and suggesting ways to address them in the new language.
In my view, the potential research outgrowths are even broader. Since these mental maps are constructed incrementally as they are needed, tools could also try to make language and library features more discoverable. For example, autocompletion helps with discovery of library methods; can something similar be done for language constructs? More broadly, in order to help programmers learn mappings, tools must understand them; can such mappings be learned automatically, perhaps based on mining source repositories?
The paper also identifies two particularly severe challenges. One comes when a feature of a new language, such as ownership in Rust, does not map to any construct the developer is familiar with. Another comes when learning an entirely new paradigm, such as functional programming, requiring a "mindshift" from the developer.
The following paper reports that learning new languages can be quite difficult, even for programming experts!
One possible response is for language designers to avoid features that are "alien" (in the words of one participant), or paradigms that require mind-shifts. But this would be shortsighted; it is the new and sometimes challenging language features that underlie the power of emerging languages such as Rust. A more nuanced take is to recognize that when documenting a new language, providing mappings between languages will not always be enough. Texts should provide in-depth coverage of ideas that have no analogs in previous languages and should help train developers to think in the new ways that are necessary to program effectively in the new language.
The paper can also facilitate an important emerging trend: considering the usability characteristics of languages in a formal way. Mindshifts can be a barrier but are also a tool language designers could use to identify target users who may already have some of the right patterns of thought. Designers can evaluate alternative language designs to discover whether there is interference with concepts their target users may already know. Finally, designers can tune their language to make mappings as easy as possible, while still preserving the core new ideas that make their language valuable.
Overall, a focus on language learning by experts offers an opportunity both to build tools and resources that help today's programmers become more effective, and to influence the design of future languages that will provide even more expressive power.
To view the accompanying paper, visit doi.acm.org/10.1145/3511062
The Digital Library is published by the Association for Computing Machinery. Copyright © 2022 ACM, Inc.