TL;DR
Modern software is polyglot by nature, but changing multiple languages in a single commit (an MPLC) comes at a high cost. This empirical study of 18 Apache projects reveals that while MPLCs make up only about 9% of total commits, they are significantly more complex, take longer to resolve, and are far more likely to introduce bugs than their single-language counterparts.
What Problem Does This Paper Address?
While we know that modern systems like Apache Spark or Kafka are written in multiple programming languages (PLs) to leverage specific strengths (e.g., performance in C++, ease of use in Python), we don't fully understand how this "polyglot" approach affects daily development.
Previous research often looked at the project level or the pull-request level. However, developers work in commits. The authors identify a gap in understanding Multi-Programming-Language Commits (MPLCs)—individual code changes that touch files written in two or more languages. The core question is: Does crossing the language barrier in a single atomic change make software harder to maintain and more prone to failure?
Methods
The researchers conducted a large-scale empirical study using the Goal-Question-Metric (GQM) approach. Their pipeline involved:
- Case Selection: Identifying 18 non-trivial Apache projects that met strict criteria (e.g., at least 2,000 commits, 20+ contributors, and a mix of at least 3 out of 18 common languages).
- Data Extraction: Mining 197,566 commits and their associated JIRA issues.
- Complexity Measurement: Calculating metrics like Lines of Code Modified (LOCM), Number of Files Modified (NOFM), and Entropy (the scattering of changes across files).
- Bug Tracking: Using the SZZ algorithm to identify "bug-introducing commits"—tracing back from a bug fix to the commit that likely caused the error.
- Statistical Rigor: Applying Mann-Whitney U tests for distribution differences and Chi-squared tests for correlations, with Benjamini-Hochberg corrections to ensure results weren't due to random chance.
Datasets
The study analyzed 18 Apache Software Foundation projects, including heavyweights like:
- Big Data/Cloud: Spark, Kafka, Beam, CarbonData, CloudStack.
- Databases/Infrastructure: CouchDB, Ignite, Impala, Thrift.
- Management: Ambari, Airavata.
The dataset spanned 197,566 commits and 18 programming languages, ranging from Java and C/C++ to specialized languages like Erlang, Haskell, and CoffeeScript.
Key Insights and Ideas
- The "Two-Language" Rule: Despite the potential for massive polyglot changes, over 90% of MPLCs involve exactly two languages. This suggests that while systems are complex, the interdependencies that require simultaneous changes are usually localized between two specific layers (e.g., a Java backend and a JavaScript frontend).
- Developers Prefer Mono-Language Changes: Only 9.3% of all commits were MPLCs. Even in highly polyglot environments, developers seem to instinctively (or through architecture) isolate changes to a single language when possible.
- The Complexity Spike: MPLCs aren't just slightly more complex; they are significantly more "scattered." The entropy of these commits is much higher, meaning changes are spread across different parts of the system, making them harder for a human to reason about during code review.
- The Quality Tax: Files modified in MPLCs are more "bug-prone." The study suggests that the lack of cross-language static analysis tools makes it easier for developers to break a contract between, say, a C++ library and its Java wrapper without realizing it.
Key Results
- Prevalence: 9.3% of all commits are MPLCs. In 83% of projects, this proportion remains stable over the project's lifetime.
- Resolution Time: In 89% of projects, issues fixed via MPLCs took significantly longer to resolve (ranging from 8% to 124% longer) than mono-language fixes.
- Complexity: MPLCs showed a 100%+ increase in the number of files and directories modified compared to non-MPLCs.
- Bug Introduction: On average, 54.2% of MPLCs introduced bugs, compared to only 32.1% of mono-language commits. In some projects like Apache Ambari, the bug-introduction rate for MPLCs exceeded 85%.
- Issue Reopen: Interestingly, MPLCs did not show a significant impact on whether an issue was reopened, suggesting that while they are harder to get right initially, they aren't necessarily "fixed" poorly more often than other commits.
Limitations and Future Work
- The "Apache" Bias: The study is limited to Apache projects, which have specific governance and quality standards. Results might differ in industrial closed-source environments or smaller GitHub repositories.
- SZZ Precision: The SZZ algorithm, while standard, has a known precision rate (around 70%). Some "bug-introducing" commits might be false positives.
- Language Scope: The study focused on 18 general-purpose languages but excluded markup (XML/HTML) and CSS, which are often part of polyglot changes.
- Future Directions: The authors suggest investigating the relationship between Software Architecture and MPLCs. Can better modularity reduce the need for cross-language commits? They also propose using MPLC status as a feature in automated bug prediction models.
Summary updated