Standard

On the “Naturalness” of Buggy Code. / Ray, Baishakhi; Hellendoorn, Vincent; Godhane, Saheel; Tu, Zhaopeng; Bacchelli, Alberto; Devanbu, Premkumar.

Proceedings - 2016 IEEE/ACM 38th IEEE International Conference on Software Engineering Companion, ICSE 2016. Vol. 1 Los Alamitos, CA : IEEE Computer Society, 2016. p. 428-439.

Research output: Scientific - peer-reviewConference contribution

Harvard

Ray, B, Hellendoorn, V, Godhane, S, Tu, Z, Bacchelli, A & Devanbu, P 2016, On the “Naturalness” of Buggy Code. in Proceedings - 2016 IEEE/ACM 38th IEEE International Conference on Software Engineering Companion, ICSE 2016. vol. 1, IEEE Computer Society, Los Alamitos, CA, pp. 428-439, 2016 IEEE/ACM 38th IEEE International Conference on Software Engineering, ICSE 2016, Austin, United States, 14-22 May. DOI: 10.1145/2884781.2884848

APA

Ray, B., Hellendoorn, V., Godhane, S., Tu, Z., Bacchelli, A., & Devanbu, P. (2016). On the “Naturalness” of Buggy Code. In Proceedings - 2016 IEEE/ACM 38th IEEE International Conference on Software Engineering Companion, ICSE 2016. (Vol. 1, pp. 428-439). Los Alamitos, CA: IEEE Computer Society. DOI: 10.1145/2884781.2884848

Vancouver

Ray B, Hellendoorn V, Godhane S, Tu Z, Bacchelli A, Devanbu P. On the “Naturalness” of Buggy Code. In Proceedings - 2016 IEEE/ACM 38th IEEE International Conference on Software Engineering Companion, ICSE 2016. Vol. 1. Los Alamitos, CA: IEEE Computer Society. 2016. p. 428-439. Available from, DOI: 10.1145/2884781.2884848

Author

Ray, Baishakhi; Hellendoorn, Vincent; Godhane, Saheel; Tu, Zhaopeng; Bacchelli, Alberto; Devanbu, Premkumar / On the “Naturalness” of Buggy Code.

Proceedings - 2016 IEEE/ACM 38th IEEE International Conference on Software Engineering Companion, ICSE 2016. Vol. 1 Los Alamitos, CA : IEEE Computer Society, 2016. p. 428-439.

Research output: Scientific - peer-reviewConference contribution

BibTeX

@inbook{06b986305baa41d7b98f26e7d26f7d4a,
title = "On the “Naturalness” of Buggy Code",
author = "Baishakhi Ray and Vincent Hellendoorn and Saheel Godhane and Zhaopeng Tu and Alberto Bacchelli and Premkumar Devanbu",
year = "2016",
month = "5",
doi = "10.1145/2884781.2884848",
volume = "1",
pages = "428--439",
booktitle = "Proceedings - 2016 IEEE/ACM 38th IEEE International Conference on Software Engineering Companion, ICSE 2016",
publisher = "IEEE Computer Society",
address = "United States",

}

RIS

TY - CHAP

T1 - On the “Naturalness” of Buggy Code

AU - Ray,Baishakhi

AU - Hellendoorn,Vincent

AU - Godhane,Saheel

AU - Tu,Zhaopeng

AU - Bacchelli,Alberto

AU - Devanbu,Premkumar

PY - 2016/5/14

Y1 - 2016/5/14

N2 - Real software, the kind working programmers produce by the kLOC to solve real-world problems, tends to be "natural", like speech or natural language; it tends to be highly repetitive and predictable. Researchers have captured this naturalness of software through statistical models and used them to good effect in suggestion engines, porting tools, coding standards checkers, and idiom miners. This suggests that code that appears improbable, or surprising, to a good statistical language model is "unnatural" in some sense, and thus possibly suspicious. In this paper, we investigate this hypothesis. We consider a large corpus of bug fix commits (ca. 7,139), from 10 different Java projects, and focus on its language statistics, evaluating the naturalness of buggy code and the corresponding fixes. We find that code with bugs tends to be more entropic (i.e. unnatural), becoming less so as bugs are fixed. Ordering files for inspection by their average entropy yields cost-effectiveness scores comparable to popular defect prediction methods. At a finer granularity, focusing on highly entropic lines is similar in cost-effectiveness to some well-known static bug finders (PMD, FindBugs) and ordering warnings from these bug finders using an entropy measure improves the cost-effectiveness of inspecting code implicated in warnings. This suggests that entropy may be a valid, simple way to complement the effectiveness of PMD or FindBugs, and that search-based bug-fixing methods may benefit from using entropy both for fault-localization and searching for fixes.

AB - Real software, the kind working programmers produce by the kLOC to solve real-world problems, tends to be "natural", like speech or natural language; it tends to be highly repetitive and predictable. Researchers have captured this naturalness of software through statistical models and used them to good effect in suggestion engines, porting tools, coding standards checkers, and idiom miners. This suggests that code that appears improbable, or surprising, to a good statistical language model is "unnatural" in some sense, and thus possibly suspicious. In this paper, we investigate this hypothesis. We consider a large corpus of bug fix commits (ca. 7,139), from 10 different Java projects, and focus on its language statistics, evaluating the naturalness of buggy code and the corresponding fixes. We find that code with bugs tends to be more entropic (i.e. unnatural), becoming less so as bugs are fixed. Ordering files for inspection by their average entropy yields cost-effectiveness scores comparable to popular defect prediction methods. At a finer granularity, focusing on highly entropic lines is similar in cost-effectiveness to some well-known static bug finders (PMD, FindBugs) and ordering warnings from these bug finders using an entropy measure improves the cost-effectiveness of inspecting code implicated in warnings. This suggests that entropy may be a valid, simple way to complement the effectiveness of PMD or FindBugs, and that search-based bug-fixing methods may benefit from using entropy both for fault-localization and searching for fixes.

UR - http://www.scopus.com/inward/record.url?scp=84971376621&partnerID=8YFLogxK

UR - http://resolver.tudelft.nl/uuid://06b98630-5baa-41d7-b98f-26e7d26f7d4a

U2 - 10.1145/2884781.2884848

DO - 10.1145/2884781.2884848

M3 - Conference contribution

VL - 1

SP - 428

EP - 439

BT - Proceedings - 2016 IEEE/ACM 38th IEEE International Conference on Software Engineering Companion, ICSE 2016

PB - IEEE Computer Society

ER -

ID: 9302736