UCL Discovery
UCL home » Library Services » Electronic resources » UCL Discovery

On the naturalness of software

Hindle, A; Barr, ET; Gabel, M; Su, Z; Devanbu, P; (2016) On the naturalness of software. Communications of the ACM , 59 (5) pp. 122-131. 10.1145/2902362. Green open access

[thumbnail of Barr_On the Naturalness of Software - E Barr.pdf]
Preview
Text
Barr_On the Naturalness of Software - E Barr.pdf - Accepted Version

Download (298kB) | Preview

Abstract

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.

Type: Article
Title: On the naturalness of software
Open access status: An open access version is available from UCL Discovery
DOI: 10.1145/2902362
Publisher version: http://dx.doi.org/10.1145/2902362
Language: English
Additional information: This version is the author accepted manuscript. For information on re-use, please refer to the publisher’s terms and conditions.
Keywords: Language models; n-gram; nature language process- ing; code completion; code suggestion
UCL classification: UCL
UCL > Provost and Vice Provost Offices > UCL BEAMS
UCL > Provost and Vice Provost Offices > UCL BEAMS > Faculty of Engineering Science
UCL > Provost and Vice Provost Offices > UCL BEAMS > Faculty of Engineering Science > Dept of Computer Science
URI: https://discovery.ucl.ac.uk/id/eprint/1505799
Downloads since deposit
1,788Downloads
Download activity - last month
Download activity - last 12 months
Downloads by country - last 12 months

Archive Staff Only

View Item View Item