Approaching Polyglot Programming: What Can We Learn from Bilingualism Studies?

Rebecca L. Hao, Elena L. GlassmanPLATEAU@UIST 2019 · DOI

TL;DR

This paper proposes a novel approach to understanding "polyglot programming" – the practice of using multiple programming languages – by drawing parallels with studies of natural language bilingualism. The authors argue that insights from psycholinguistics can guide research into how using multiple programming languages affects programmers, leading to better language design and improved developer productivity.

What Problem Does This Paper Address?

In today's software development landscape, programmers are increasingly expected to work with multiple programming languages simultaneously. This practice, known as "polyglot programming," is driven by the need to leverage the strengths of different languages for specific tasks, reuse existing code, and integrate various systems. However, despite its ubiquity, there's a significant gap in our understanding of how this practice impacts programmers. We lack a clear picture of the cognitive load, potential interference effects, and overall influence on a programmer's skills and productivity. This paper aims to bridge this gap by suggesting a framework for studying polyglot programming, inspired by the well-established field of natural language bilingualism research.

Methods

The paper doesn't present a specific empirical study with novel algorithms or datasets. Instead, its primary contribution lies in proposing a conceptual framework and outlining research questions. The "method" is essentially an analogy: drawing inspiration from psycholinguistic studies of bilingualism. The authors suggest adapting methodologies and hypotheses from natural language research to the domain of programming languages. This includes:

  • Analogy to Code-Switching: Comparing the act of switching between programming languages to "code-switching" in natural languages, where speakers alternate between languages.
  • Analogy to Cross-Linguistic Influence: Exploring how knowledge of one programming language might unintentionally influence the use or understanding of another, similar to how one natural language can affect another.
  • Focus on Cognitive Control: Investigating the cognitive effort involved in switching between programming languages, drawing parallels to studies on cognitive control in bilinguals.

Datasets

Not discussed in the paper.

Key Insights and Ideas

  • Bilingualism as a Model: The core idea is that the extensive research on natural language bilingualism offers a rich source of hypotheses, methodologies, and theoretical frameworks that can be adapted to study polyglot programming.
  • Code-Switching in Programming: Programmers likely "code-switch" at various granularities – within a line, across lines, between logical blocks, or even between files. Understanding these patterns can reveal how programmers manage multiple languages.
  • Cross-Linguistic Influence in Code: Just as one natural language can influence another (e.g., accents, grammatical structures), one programming language might introduce "interferences" or "transfers" into the use of another. This could manifest as using syntax or concepts from one language when intending to use another.
  • Cognitive Cost of Switching: Switching between programming languages might incur a cognitive cost, similar to task-switching in natural language. This cost could be influenced by factors like language proficiency and the relationship between the languages.
  • Potential for "Bilingual Advantage": The paper speculates whether polyglot programming might confer a "bilingual advantage" in non-linguistic tasks requiring cognitive control, mirroring findings in natural language bilingualism. This could translate to improved general programming skills or problem-solving abilities.

Key Results

This paper is primarily a conceptual proposal and does not present empirical results. It outlines research questions and suggests avenues for future investigation rather than reporting findings from experiments.

Limitations and Future Work

The authors acknowledge that programming languages and natural languages have differences, and direct translation of findings might not be perfect. The main limitation is the lack of empirical data and established methodologies for studying polyglot programming.

Future work suggested by the paper includes:

  • Investigating Cross-Linguistic Influence: Designing studies to detect instances where programmers accidentally use syntax or concepts from one language while coding in another. This could involve observing programmers, analyzing code repositories, and examining forum discussions for questions about language equivalences.
  • Characterizing Language Influence: Determining which programming languages are more prone to influencing others, and if this influence is related to language paradigms (e.g., static vs. dynamic typing, object-oriented vs. functional).
  • Understanding Code-Switching Contexts: Studying the specific contexts and motivations behind programmers' code-switching behavior.
  • Measuring Cognitive Load: Using methods like eye-tracking or neuroimaging (e.g., MEG) to quantify the cognitive effort involved in switching between programming languages and to explore if this cost can be mitigated.
  • Exploring Proficiency Effects: Investigating how a programmer's proficiency in different languages affects the cognitive cost of switching and the likelihood of cross-linguistic influence.
  • Extending to Language Learning: Applying the polyglot programming framework to study programming language learning, including whether knowing multiple languages enhances understanding of core programming concepts.

Summary updated

BibTeX
@inproceedings{hao2019approaching,
  author = {Rebecca L. Hao and Elena L. Glassman},
  title = {{Approaching Polyglot Programming: What Can We Learn from Bilingualism Studies?}},
  booktitle = {PLATEAU@UIST},
  year = {2019},
  doi = {10.4230/oasics.plateau.2019.1},
}
Figure