4.6 Article

On the Naturalness of Software

Journal

COMMUNICATIONS OF THE ACM
Volume 59, Issue 5, Pages 122-131

Publisher

ASSOC COMPUTING MACHINERY
DOI: 10.1145/2902362

Keywords

-

Funding

  1. National Science Foundation [1445079, 1247280, 1414172]
  2. Direct For Computer & Info Scie & Enginr [1247280] Funding Source: National Science Foundation
  3. Division Of Computer and Network Systems
  4. Direct For Computer & Info Scie & Enginr [1445079] Funding Source: National Science Foundation
  5. Division of Computing and Communication Foundations [1247280] Funding Source: National Science Foundation
  6. Division of Computing and Communication Foundations
  7. Direct For Computer & Info Scie & Enginr [1414172] Funding Source: National Science Foundation
  8. Engineering and Physical Sciences Research Council [EP/J017515/1] Funding Source: researchfish
  9. EPSRC [EP/J017515/1] Funding Source: UKRI

Ask authors/readers for more resources

Natural languages like English are rich, complex, and powerful. The highly creative and graceful use of languages like English and Tamil, by masters like Shakespeare and Avvaiyar, can certainly delight and inspire. But in practice, given cognitive constraints and the exigencies of daily life, most human utterances are far simpler and much more repetitive and predictable. In fact, these utterances can be very usefully modeled using modern statistical methods. This fact has led to the phenomenal success of statistical approaches to speech recognition, natural language translation, question-answering, and text mining and comprehension. We begin with the conjecture that most software is also natural, in the sense that it is created by humans at work, with all the attendant constraints and limitations-and thus, like natural language, it is also likely to be repetitive and predictable. We then proceed to ask whether (a) code can be usefully modeled by statistical language models and (b) such models can be leveraged to support software engineers. Using the widely adopted n-gram model, we provide empirical evidence supportive of a positive answer to both these questions. We show that code is also very regular, and, in fact, even more so than natural languages. As an example use of the model, we have developed a simple code completion engine for Java that, despite its simplicity, already improves Eclipse's completion capability. We conclude the paper by laying out a vision for future research in this area.

Authors

I am an author on this paper
Click your name to claim this paper and add it to your profile.

Reviews

Primary Rating

4.6
Not enough ratings

Secondary Ratings

Novelty
-
Significance
-
Scientific rigor
-
Rate this paper

Recommended

No Data Available
No Data Available