• DocumentCode
    2442129
  • Title

    On the naturalness of software

  • Author

    Hindle, Abram ; Barr, Earl T. ; Su, Zhendong ; Gabel, Mark ; Devanbu, Premkumar

  • Author_Institution
    Dept. of Comput. Sci., Univ. of California at Davis, Davis, CA, USA
  • fYear
    2012
  • fDate
    2-9 June 2012
  • Firstpage
    837
  • Lastpage
    847
  • 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 repetitive, 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 built-in completion capability. We conclude the paper by laying out a vision for future research in this area.
  • Keywords
    natural language processing; software engineering; statistical analysis; Eclipse built-in completion capability; English; Tamil; n-gram model; natural language translation; question-answering; software naturalness; speech recognition; statistical language models; statistical methods; text comprehension; text mining; Computational modeling; Entropy; Java; Natural language processing; Software; Speech recognition; code completion; code suggestion; language models; n-gram; natural language processing;
  • fLanguage
    English
  • Publisher
    ieee
  • Conference_Titel
    Software Engineering (ICSE), 2012 34th International Conference on
  • Conference_Location
    Zurich
  • ISSN
    0270-5257
  • Print_ISBN
    978-1-4673-1066-6
  • Electronic_ISBN
    0270-5257
  • Type

    conf

  • DOI
    10.1109/ICSE.2012.6227135
  • Filename
    6227135