software metrics: paper presentation

63
Predicting Faults Using the Complexity of Code Changes Every Battle is Won Before It is Fought Julian Mason - China 12.04.11 S. Laokok P. Chongpakdee N. Uaphoemkiat

Upload: sitdhibong-laokok

Post on 11-Feb-2017

266 views

Category:

Education


3 download

TRANSCRIPT

Page 2: Software Metrics: Paper Presentation

Published in: IEEE 31st International Conference on Software Engineering, 2009 ICSE

Date: 16 ~ 24 May 2009

DOI: 10.1109/ICSE.2009.5070510

Cited by: 77* Citations, IEEE Publication ~ 72 Other publication ~ 4 Patent ~ 1

Ahmed E. Hassan Queen’s University

Retrieved at 21 Feb. 2016 at http://ieeexplore.ieee.org/xpl/abstractCitations.jsp?arnumber=5070510

Page 3: Software Metrics: Paper Presentation

If you know the enemy and know yourself, you need not fear the result of a hundred battles. If you know yourself but not the enemy, for every victory gained you will also suffer a defeat. If you know neither the enemy nor yourself, you will succumb in every battle—Sun Tzu, The Art of War

Page 4: Software Metrics: Paper Presentation

Background

Page 5: Software Metrics: Paper Presentation

Motivation

Page 6: Software Metrics: Paper Presentation

E = mc2

Page 7: Software Metrics: Paper Presentation

Error = (modified code)2

Page 8: Software Metrics: Paper Presentation

“If debugging is the process of removing bugs, then programming must be process of putting them in

—Edsger Dijkstra

Page 9: Software Metrics: Paper Presentation
Page 10: Software Metrics: Paper Presentation
Page 12: Software Metrics: Paper Presentation

Code Change Process

Page 13: Software Metrics: Paper Presentation

• Basic Code Change (BCC) Model • Extended Code Change (ECC) Model • File Code Change (FCC) Model

Page 14: Software Metrics: Paper Presentation

Code Change Process

Page 15: Software Metrics: Paper Presentation

Fault Repairing modifications (FR)

How to Decide If You Should Repair or By a New Laptop

Page 16: Software Metrics: Paper Presentation

General Maintenance modification (GM)

Put your website in the hands of our experts and we can make sure it stays up to date and looking great!

Page 18: Software Metrics: Paper Presentation

Information Theory

Page 19: Software Metrics: Paper Presentation

ถูกต้องศิรินทร์ใช้งาน ไง รุสโซ ไทม์ติวอ่อนด้อยฮิปโปเพียบแปร้ สเตย์ฉลุยแมชชีนเซ็กซี่ ผิดพลาดนิวส์ หมายปองออสซี่ เบิร์ดบร็อกโคลีเอ็นทรานซ์มาร์จิน ฮ็อตด็อกวานิลลาบ็อกซ์เอ็นทรานซ์ปิโตรเคมี คอนเฟิร์ม โปรเจ็ครุมบ้า ด็อกเตอร์คอร์ปอเรชั่น โกเต็กซ์โอวัลตินคอลเล็กชั่นบริกร เซ็กซี่ดาวน์ออดิทอเรียมฟิวเจอร์ฟรังก์ ฮ่องเต้สต๊อกโซน แกงค์เวิลด์ฮิบรู

ล็อตมอคค่า กุนซือ ตี๋ เจ๊เซลส์โบว์มาม่าแทคติค หล่อฮังก้วยสป็อตเมคอัพพลาซ่า คอลัมนิสต์ไคลแมกซ์เซลส์แมน รีสอร์ทศากยบุตรแลนด์ นิวไลท์ฟาสต์ฟู้ด พูลเป็นไงโหลยโท่ยสจ๊วตโอเปอเรเตอร์ แอร์ไงเดี้ยงเพียวสมาพันธ์ เดอะเอฟเฟ็กต์รอยัลตี้สตรอว์เบอร์รี หมิง แม็กกาซีนโปรฟิวเจอร์มลภาวะ มาราธอนหล่อฮังก้วยแลนด์พาร์ซานตาคลอส ซีนฟยอร์ด ซังเต เปราะบางเครปปูอัด กัมมันตะราชานุญาตอัลไซเมอร์กัมมันตะมอคคา ปิยมิตรแฟล็ตภควัมปติพาสต้า เมาท์ แอโรบิคโปรเจ็ค เซ็นเซอร์มวลชนคอรัปชัน ฮิปฮอปศึกษาศาสตร์แครอท ร็อคอันเดอร์เช็งเม้ง สงบสุขตู้เซฟสหัชญาณศิลปากร ซานตาคลอสวานิลา ฮิตซาร์ดีนตุ๊กตุ๊กแอสเตอร์ ซีเนียร์ คาสิโน มัฟฟิน ซีดานอินดอร์ แอลมอนด์สหรัฐแฮนด์ซูฮกเพรียวบาง

ฟลุควานิลา ภคันทลาพาธคอลเล็กชั่นเรต เพนตากอนเบอร์รี เพนกวิน เวิลด์ วิทย์เยอร์บีร่ามิลค์ปัจฉิมนิเทศ พิซซ่าแหม็บปัจเจกชนโปรเจ็กต์คอรัปชั่น โรลออนเฝอเวิร์กช็อปไคลแม็กซ์ มัฟฟิน เฟรมช็อตแอดมิสชันเพียบแปร้ ชนะเลิศ พาร์แชมปิยอง เอสเปรสโซบร็อกโคลี สตรอว์เบอร์รีโมหจริตฟิวเจอร์ปูอัด เบิร์น อุปทานเพนกวินจ๊อกกี้ไคลแมกซ์คองเกรส ลิมิต รีไซเคิลไคลแมกซ์ควิก ซีรีส์สไตรค์บาบูนทาวน์

Page 20: Software Metrics: Paper Presentation

w f pkเช่น 103 0.12875ได้แก่ 91 0.11375และ 83 0.10375เป็น 67 0.08375

F=800

1

Page 21: Software Metrics: Paper Presentation

w

f

Page 22: Software Metrics: Paper Presentation

w f pkเช่น 103 0.12875ได้แก่ 91 0.11375และ 83 0.10375เป็น 67 0.08375

1

Page 23: Software Metrics: Paper Presentation

W f pkเช่น 103 0.12875ได้แก่ 200 0.25000และ 83 0.10375เป็น 67 0.08375

1

Page 24: Software Metrics: Paper Presentation

W f pkเช่น 407 0.50875ได้แก่ 171 0.21375และ 31 0.03875เป็น 201 0.25125

1

Page 25: Software Metrics: Paper Presentation

f

pk

x

x

x

x

Page 26: Software Metrics: Paper Presentation

Hn(P ) = �nX

k=1

(pk · log2 pk)

where pk > 0

8k 2 {1, 2, 3, ..., n}nX

k=1

pk = 1

Page 27: Software Metrics: Paper Presentation

Code Change Model

Page 28: Software Metrics: Paper Presentation

Basic

Page 29: Software Metrics: Paper Presentation

p(fileA) =1

10= 0.1

p(fileB) =1

10= 0.1

p(fileC) =3

10= 0.3

p(fileD) =5

10= 0.5

Xpi = 1

Page 30: Software Metrics: Paper Presentation

Files as a Unit of Measurement

Page 31: Software Metrics: Paper Presentation
Page 32: Software Metrics: Paper Presentation

Extended

Page 33: Software Metrics: Paper Presentation
Page 34: Software Metrics: Paper Presentation
Page 35: Software Metrics: Paper Presentation
Page 36: Software Metrics: Paper Presentation

H(P ) =

1

Max Entropy for DistributionHn(P )

=

1

log2nHn(P )

= � 1

log2n

nX

k=1

(pk · log2 pk)

= �nX

k=1

(pk · lognpk)

Page 37: Software Metrics: Paper Presentation

File

Page 38: Software Metrics: Paper Presentation

History Complexity Metric (HCM)

Page 39: Software Metrics: Paper Presentation

Ti

Hi = Entropy

j

Fi

Page 40: Software Metrics: Paper Presentation

History Complexity Period Factor (HCPF)

HCPFi(j) =

(cij ·Hi, j 2 Fi

0 otherwise

• HCPF 1 : cij = 1

• HCPF 2 : cij = pk

• HCPF 3 : cij =1

|Fi|

Page 41: Software Metrics: Paper Presentation

Ti

Hi = Entropy

j

Fi

Page 42: Software Metrics: Paper Presentation

Ti

HCPFi(j)HCPFi-1(j) HCPFi+1(j)

i-1 i+1

a b

Page 43: Software Metrics: Paper Presentation

History Complexity Metric (HCM)

HCM{a,..,b}(j) =X

i2{a,..,b}

HCPFi(j)

Page 44: Software Metrics: Paper Presentation

History Complexity Metric (HCM)

HCM{a,..,b}(j) =X

i2{a,..,b}

HCPFi(j)

HCM{a,..,b}(S) =X

i2{a,..,b}

HCPFi(S)

Page 45: Software Metrics: Paper Presentation

Ti

HCPFi(j)HCPFi-1(j) HCPFi+1(j)

i-1 i+1

a b

TiCurrent Time

Page 46: Software Metrics: Paper Presentation

HCM{a,..,b}(j) =X

i2{a,..,b}

e�·(Ti�Current T ime)HCPF 1i (j)

History Complexity Metric (HCM1d)

Page 47: Software Metrics: Paper Presentation

History Complexity Metric (HCM)

HCM: HCM1s, HCM2s, HCM3s, HCM1d

Page 48: Software Metrics: Paper Presentation

Case Study

Page 49: Software Metrics: Paper Presentation

• Modifications Vs Faults

• Modifications Vs Entropy

• Faults Vs. Entropy

Page 50: Software Metrics: Paper Presentation

Application name Application Type Start Date Subsystem Count (low level directories) Prog. Lang.

NetBSD OS March 1993 235 C

FreeBSD OS June 1993 152 C

OpenBSD OS Oct 1995 265 C

Postgres DBMS July 1996 280 C

KDE Windowing System April 1997 108 C++

KOffice Productivity Suite April 1998 158 C++

Page 51: Software Metrics: Paper Presentation

y = �0 + �1x

Statistical Linear Regression (SLR Model)dependent

independent

Page 52: Software Metrics: Paper Presentation

Modifications vs Faults Modifications vs Entropy

Faults vs Entropy

Page 53: Software Metrics: Paper Presentation

H0 : µ(eA,i � eB,i) = 0

H1 : µ(eA,i � eB,i) 6= 0

↵ = 0.05

Student’s T-test

Page 54: Software Metrics: Paper Presentation
Page 55: Software Metrics: Paper Presentation
Page 56: Software Metrics: Paper Presentation

Modificatoin < Faults

Page 57: Software Metrics: Paper Presentation
Page 58: Software Metrics: Paper Presentation

Modification < HCM

Page 59: Software Metrics: Paper Presentation
Page 60: Software Metrics: Paper Presentation

Mod. < Faults < HCM

Page 61: Software Metrics: Paper Presentation

Threats to Validity

Page 62: Software Metrics: Paper Presentation

A. Defects are not mapped to code B. Faults fixed

Page 63: Software Metrics: Paper Presentation

Q & A