HackerPapers

arXiv:1402.4182cs.SE

Learning Natural Coding Conventions

Miltiadis Allamanis, Earl T. Barr, Christian Bird, Charles Sutton

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

Every programmer has a characteristic style, ranging from preferences about identifier naming to preferences about object relationships and design patterns. Coding conventions define a consistent syntactic style, fostering readability and hence maintainability. When collaborating, programmers strive to obey a project's coding conventions. However, one third of reviews of changes contain feedback about coding conventions, indicating that programmers do not always follow them and that project members care deeply about adherence. Unfortunately, programmers are often unaware of coding conventions because inferring them requires a global view, one that aggregates the many local decisions programmers make and identifies emergent consensus on style. We present NATURALIZE, a framework that learns the style of a codebase, and suggests revisions to improve stylistic consistency. NATURALIZE builds on recent work in applying statistical natural language processing to source code. We apply NATURALIZE to suggest natural identifier names and formatting conventions. We present four tools focused on ensuring natural code during development and release management, including code review. NATURALIZE achieves 94% accuracy in its top suggestions for identifier names and can even transfer knowledge about conventions across projects, leveraging a corpus of 10,968 open source projects. We used NATURALIZE to generate 18 patches for 5 open source projects: 14 were accepted.

arXiv comments
Journal reference
DOI
doi:10.1145/2635868.2635883
Subjects
cs.SESoftware Engineering

On Hacker News

Linked by 1 identifiable commenter in 2 comments across 2 threads, from Jun 2014 to Jun 2014.

Comments linking this paper, per year.

Discussed in comments2 threads

    • This is a new and very interesting area in machine learning and software engineering. Anyone interested might also find the following papers interesting too Hindle, Abram, et al. "On the naturalness of software." Software Engineering (ICSE), 2012 34th International Conference…

      mallamanisView on HNParent context

    • Naturalize ( http://groups.inf.ed.ac.uk/naturalize/ ) is another related machine learning based tool that suggests appropriate identifier names for Java. Details on the implementation and an evaluation may be found here http://arxiv.org/abs/1402.4182

      mallamanisView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.