Using DNA fingerprin.ng techniques for the discovery of - - PowerPoint PPT Presentation

using dna fingerprin ng techniques for the discovery of
SMART_READER_LITE
LIVE PREVIEW

Using DNA fingerprin.ng techniques for the discovery of - - PowerPoint PPT Presentation

Using DNA fingerprin.ng techniques for the discovery of so9ware code clones/siblings Thomas Shippey, David Bowes and Bruce Chris2anson Science and Technology


slide-1
SLIDE 1

Using ¡DNA ¡fingerprin.ng ¡ techniques ¡for ¡the ¡discovery ¡of ¡ so9ware ¡code ¡clones/siblings ¡

Thomas ¡Shippey, ¡David ¡Bowes ¡and ¡ Bruce ¡Chris2anson ¡

Science ¡and ¡Technology ¡Research ¡Ins2tute ¡ University ¡of ¡Her>ordshire ¡

¡

slide-2
SLIDE 2

Mo2va2on ¡

① Hall ¡et ¡al ¡2011: ¡TSE ¡Systema2c ¡Literature ¡Review ¡of ¡defect ¡predic2on ¡studies ¡ ¡ ② Gray ¡et ¡al ¡2009,2011 ¡: ¡“There ¡are ¡not ¡enough ¡descrip2ve ¡SoNware ¡Code ¡Metrics ¡ (SCM) ¡for ¡defect ¡predic2on” ¡”Why ¡are ¡there ¡so ¡many ¡duplicate ¡instances?” ¡ ¡ ③ Shepperd ¡et ¡al ¡2011 ¡(in ¡review) ¡: ¡“Who ¡does ¡the ¡study ¡and ¡the ¡independent ¡variables ¡ are ¡the ¡key ¡to ¡the ¡variability ¡in ¡defect ¡predic2on ¡studies” ¡(~80% ¡of ¡variance) ¡ ¡ ④ Zhang ¡et ¡al ¡2008 ¡“Do ¡Bad ¡Smells ¡Indicate ¡‘Trouble’ ¡in ¡Code?” ¡ ¡ ⑤ Krinke ¡IWSC ¡2011:”Was ¡Fowler ¡right ¡in ¡saying ¡duplicate ¡code ¡is ¡the ¡number ¡one ¡bad ¡ thing ¡in ¡code?” ¡ ¡ ⑥ Zhang ¡et ¡al ¡2011 ¡(in ¡review) ¡“Bad ¡smells ¡are ¡not ¡always ¡bad!” ¡ ⑦ Weimer ¡et ¡al ¡2009: ¡ICSE ¡“Automa2cally ¡finding ¡patches ¡using ¡gene2c ¡programming” ¡

slide-3
SLIDE 3

DNA ¡Fingerprin2ng ¡

Image ¡from ¡: ¡Nature ¡Protocols ¡1, ¡518 ¡-­‑ ¡525 ¡(2006) ¡ ¡ doi:10.1038/nprot.2006.73 ¡

Jeffreys ¡A.J., ¡Wilson ¡V., ¡Thein ¡S.W. ¡(1984). ¡ ¡ "Hypervariable ¡'minisatellite' ¡regions ¡in ¡human ¡DNA". ¡ ¡ Nature ¡314: ¡67–73. ¡doi:10.1038/314067a0. ¡

slide-4
SLIDE 4

Proposi2on ¡

  • The ¡long ¡term ¡aim ¡of ¡Thomas’s ¡thesis ¡is ¡to: ¡

– generate ¡another ¡Sta2c ¡Code ¡Metric ¡ ¡based ¡on ¡ code ¡clones ¡ ¡

  • DNA ¡fingerprin2ng: ¡ ¡

– Understand ¡what ¡happens ¡to ¡code ¡when ¡it ¡is ¡ cloned ¡

  • Answer ¡a ¡ques2on: ¡ ¡

¡Are ¡code ¡clones ¡bad ¡(number ¡of ¡faults) ¡? ¡

slide-5
SLIDE 5

What ¡I ¡did ¡

  • AST ¡Based ¡
  • Method ¡Level ¡(restric2on ¡points) ¡
  • Transformed ¡methods ¡in ¡to ¡‘KindSequences’ ¡
  • Sequence ¡Alignment ¡used ¡to ¡compare ¡(Similar ¡

to ¡Greenan, ¡2005) ¡

  • Compared ¡possible ¡clones ¡found ¡with ¡those ¡

found ¡by ¡CCFinder ¡(Kamiya ¡et ¡al. ¡2002) ¡

Datasets ¡: ¡BlueJ ¡3.0.4 ¡and ¡Eclipse ¡3.2 ¡and ¡Apache ¡Commons ¡ ¡

slide-6
SLIDE 6

What ¡I ¡did ¡

  • Method: ¡

¡

¡ ¡ ¡

  • Becomes: ¡ ¡

METHOD;MODIFIERS;PRIMITIVE ¡TYPE;BLOCK;VARIABLE; ¡ MODIFIERS;PRIMITIVE ¡TYPE; ¡INT ¡LITERAL;FOR ¡LOOP; ¡ VARIABLE;MODIFIERS;PRIMITIVE ¡TYPE; ¡INT ¡LITERAL; ¡ LESS ¡THAN; ¡IDENTIFIER; ¡IDENTIFIER;EXPRESSION ¡STATEMENT; ¡ POSTFIX ¡INCREMENT; ¡IDENTIFIER;BLOCK;EXPRESSION ¡STATEMENT; ¡ METHOD ¡INVOCATION;MEMBER ¡SELECT;MEMBER ¡ SELECT;IDENTIFIER;MULTIPLY; ¡IDENTIFIER; ¡IDENTIFIER; ¡ ¡

slide-7
SLIDE 7

What ¡I ¡did ¡

  • AST ¡Based ¡
  • Method ¡Level ¡(restric2on ¡points) ¡
  • Transformed ¡methods ¡in ¡to ¡‘KindSequences’ ¡
  • Sequence ¡Alignment ¡used ¡to ¡compare ¡(Similar ¡

to ¡Greenan, ¡2005) ¡

  • Compared ¡possible ¡clones ¡found ¡with ¡those ¡

found ¡by ¡CCFinder ¡(Kamiya ¡et ¡al. ¡2002) ¡

Datasets ¡: ¡BlueJ ¡3.0.4 ¡and ¡Eclipse ¡3.2 ¡and ¡Apache ¡Commons ¡ ¡

slide-8
SLIDE 8

Sequence ¡Alignment ¡

Needleman-­‑Wunsch ¡algorithm ¡ ¡ (Needleman ¡and ¡Wunsch ¡1970) ¡

  • Two ¡sequences ¡to ¡compare ¡– ¡
  • AAGTC ¡
  • AGTC ¡ ¡
  • Similarity ¡Matrix: ¡

¡ ¡ ¡ ¡ ¡ ¡ ¡

¡ ¡

A ¡ G ¡ C ¡ T ¡ A ¡ 10 ¡

  • ­‑1 ¡
  • ­‑3 ¡
  • ­‑4 ¡

G ¡

  • ­‑1 ¡

7 ¡

  • ­‑5 ¡
  • ­‑3 ¡

C ¡

  • ­‑3 ¡
  • ­‑5 ¡

9 ¡ 0 ¡ T ¡

  • ­‑4 ¡
  • ­‑3 ¡

0 ¡ 8 ¡

slide-9
SLIDE 9

A ¡ A ¡ G ¡ T ¡ C ¡ 0 ¡

  • ­‑10 ¡
  • ­‑20 ¡
  • ­‑30 ¡
  • ­‑40 ¡
  • ­‑50 ¡

A ¡

  • ­‑10 ¡

? ¡ G ¡

  • ­‑20 ¡

T ¡

  • ­‑30 ¡

C ¡

  • ­‑40 ¡

A ¡ A ¡ G ¡ T ¡ C ¡ 0 ¡

  • ­‑10 ¡
  • ­‑20 ¡
  • ­‑30 ¡
  • ­‑40 ¡
  • ­‑50 ¡

A ¡

  • ­‑10 ¡

10 ¡ 0 ¡

  • ­‑10 ¡
  • ­‑20 ¡
  • ­‑30 ¡

G ¡

  • ­‑20 ¡

0 ¡ 9 ¡ 7 ¡

  • ­‑3 ¡
  • ­‑13 ¡

T ¡

  • ­‑30 ¡
  • ­‑10 ¡
  • ­‑1 ¡

6 ¡ 15 ¡ 5 ¡ C ¡

  • ­‑40 ¡
  • ­‑20 ¡
  • ­‑11 ¡
  • ­‑4 ¡

6 ¡ 12 ¡ A ¡ A ¡ G ¡ T ¡ C ¡ 0 ¡

  • ­‑10 ¡
  • ­‑20 ¡
  • ­‑30 ¡
  • ­‑40 ¡
  • ­‑50 ¡

A ¡

  • ­‑10 ¡

10 ¡ 0 ¡

  • ­‑10 ¡
  • ­‑20 ¡
  • ­‑30 ¡

G ¡

  • ­‑20 ¡

0 ¡ 9 ¡ 7 ¡

  • ­‑3 ¡
  • ­‑13 ¡

T ¡

  • ­‑30 ¡
  • ­‑10 ¡
  • ­‑1 ¡

6 ¡ 15 ¡ 5 ¡ C ¡

  • ­‑40 ¡
  • ­‑20 ¡
  • ­‑11 ¡
  • ­‑4 ¡

6 ¡ 12 ¡ N.B. ¡Java ¡code ¡has ¡94 ¡Kinds ¡using ¡Javac.Tree. ¡ ¡ Currently ¡the ¡Java ¡simularity ¡matrix ¡is ¡a ¡94x94 ¡iden2ty ¡matrix ¡ A ¡ A ¡ G ¡ T ¡ C ¡ A ¡

  • ­‑ ¡

G ¡ T ¡ C ¡

Sequence ¡Alignment ¡

= ¡0 ¡+ ¡10 ¡= ¡10 ¡ = ¡-­‑10 ¡-­‑10 ¡= ¡-­‑20 ¡ = ¡-­‑10 ¡-­‑10 ¡= ¡-­‑20 ¡ The ¡completed ¡sequence ¡alignment ¡-­‑ ¡ ¡

slide-10
SLIDE 10

Descrip2ve ¡Sta2s2cs ¡

Sta2s2c ¡ BlueJ ¡3.0.4 ¡ Eclipse ¡3.2 ¡ Apache ¡Commons ¡ Total ¡Source ¡Files ¡ 596 ¡ 660 ¡ 277 ¡ Total ¡Possible ¡CC ¡ 6,183 ¡ 7,861 ¡ 4,801 ¡ Max ¡KindSequence ¡length ¡ 437 ¡ 481 ¡ 416 ¡ Min ¡KindSequence ¡Length ¡ 3 ¡ 3 ¡ 3 ¡

  • No. ¡of ¡KindSequence ¡over ¡

100 ¡ 56 ¡ 93 ¡ 8* ¡

Table ¡1: ¡Descrip5ve ¡Sta5s5cs ¡for ¡the ¡possible ¡cloned ¡methods ¡in ¡the ¡selected ¡source ¡codes. ¡ ¡ ¡ ¡ ¡90% ¡match ¡and ¡above ¡only. ¡ ¡

slide-11
SLIDE 11

Checking ¡for ¡False ¡Posi2ves ¡

Fig ¡1: ¡KindLists ¡over ¡300 ¡in ¡BlueJ ¡have ¡100% ¡match ¡rate ¡ ¡ (inter ¡rater ¡reliability ¡-­‑ ¡Kappa ¡sta2s2c ¡-­‑ ¡0.726 ¡ ¡Good ¡(86% ¡agreement)) ¡

0 ¡ 10 ¡ 20 ¡ 30 ¡ 40 ¡ 50 ¡ 60 ¡ 70 ¡ 80 ¡ 90 ¡ 100 ¡ <100 ¡ 100 ¡> ¡x ¡> ¡200 ¡ 200 ¡> ¡x ¡> ¡300 ¡ 300 ¡> ¡x ¡> ¡400 ¡ 400+ ¡ KindSequence ¡Length ¡(BlueJ ¡3.0.4 ¡results) ¡ % ¡Match ¡ N ¡-­‑ ¡Number ¡of ¡unique ¡matches ¡

slide-12
SLIDE 12

Results ¡

Source ¡Code ¡ Our ¡Method ¡ ¡ (Over ¡100 ¡kind ¡lengths) ¡ CCFinder ¡ Eclipse ¡3.2 ¡ 93 ¡ 417 ¡ BlueJ ¡3.0.4 ¡ 56 ¡ 370 ¡ Apache ¡Commons ¡ 8 ¡ 334 ¡ Table ¡2: ¡Clones ¡found ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡CCFinder ¡finds ¡more ¡clones ¡ Code ¡Clone ¡ Type ¡ Our ¡method ¡ CCFinder ¡ % ¡ 1 ¡ 3 ¡ 3 ¡ 100 ¡ 2 ¡ 6 ¡ 6 ¡ 100 ¡ 3 ¡ 24 ¡ 14 ¡ 58 ¡ Table ¡3: ¡Clones ¡found ¡by ¡type ¡on ¡the ¡BlueJ ¡source ¡code ¡ ¡CCFinder ¡does ¡not ¡find ¡all ¡the ¡type ¡3 ¡clones. ¡ ¡ ¡(UnitTest ¡files ¡removed ¡from ¡BlueJ ¡source ¡) ¡

slide-13
SLIDE 13

Conclusions ¡+ ¡Future ¡Work ¡

  • Sequence ¡alignment ¡finds ¡code ¡clones ¡
  • High ¡volume ¡of ¡small ¡sequences ¡
  • Good ¡at ¡finding ¡type ¡3? ¡ ¡

¡

  • Open ¡out ¡restric2on ¡point ¡and ¡

profile ¡‘methods’ ¡

  • Test ¡further ¡
  • Improving ¡similarity ¡matrix ¡– ¡possible ¡use ¡to ¡find ¡

seman2c ¡clones ¡

  • The ¡need ¡for ¡a ¡baseline ¡code ¡clone ¡dataset ¡for ¡

comparisons ¡

slide-14
SLIDE 14

Thank ¡you ¡for ¡listening ¡

Any ¡Ques2ons? ¡ ¡

slide-15
SLIDE 15

Points ¡to ¡Ponder ¡

  • Manual ¡inspec2on: ¡

– Short ¡methods: ¡cloned ¡or ¡re-­‑typed? ¡ – Tests ¡files ¡follow ¡a ¡pa‚ern? ¡

slide-16
SLIDE 16

References ¡

  • T. ¡Hall, ¡S. ¡Beecham, ¡D. ¡Bowes, ¡D. ¡Gray, ¡and ¡S. ¡Counsell, ¡A ¡Systema2c ¡Literature ¡Review ¡on ¡Fault ¡

Predic2on ¡Performance ¡in ¡SoNware ¡Engineering. ¡IEEE ¡Transac2ons ¡in ¡SoNware ¡Engineering ¡

  • D. ¡Gray, ¡D. ¡Bowes, ¡N. ¡Davey, ¡Yi ¡Sun, ¡and ¡B. ¡Chris2anson. ¡The ¡misuse ¡of ¡the ¡nasa ¡metrics ¡data ¡

program ¡data ¡sets ¡for ¡automated ¡soNware ¡defect ¡predic2on. ¡In ¡Evalua2on ¡and ¡Assessment ¡in ¡ SoNware ¡Engineering ¡(EASE), ¡2011 ¡

  • Min ¡Zhang, ¡Tracy ¡Hall, ¡Nathan ¡Baddoo ¡and ¡Paul ¡Wernick ¡Do ¡Code ¡Bad ¡Smells ¡Indicate ¡"Trouble" ¡in ¡

Code? ¡,Interna2onal ¡Workshop ¡on ¡Defects ¡in ¡Large ¡SoNware ¡Systems ¡(DEFECTS ¡2008) ¡

  • Weimer, ¡Westley ¡and ¡Nguyen, ¡ThanhVu ¡and ¡Le ¡Goues, ¡Claire ¡and ¡Forrest, ¡Stephanie ¡Automa5cally ¡

finding ¡patches ¡using ¡gene5c ¡programming ¡in ¡Proceedings ¡of ¡the ¡31st ¡Interna2onal ¡Conference ¡on ¡ SoNware ¡Engineering ¡2009 ¡

  • Toshihiro ¡Kamiya, ¡Shinji ¡Kusumoto, ¡and ¡Katsuro ¡Inoue. ¡CCFinder: ¡a ¡mul2linguis2c ¡token ¡based ¡code ¡

clone ¡detec2on ¡system ¡for ¡large ¡scale ¡source ¡code. ¡IEEE ¡Trans. ¡SoNw. ¡Eng., ¡July ¡2002. ¡

  • Saul ¡B. ¡Needleman ¡and ¡Chris2an ¡D. ¡Wunsch. ¡A ¡general ¡method ¡applicable ¡to ¡the ¡search ¡for ¡

similari2es ¡in ¡the ¡amino ¡acid ¡sequence ¡of ¡two ¡proteins. ¡Journal ¡of ¡Molecular ¡Biology, ¡48(3):443 ¡-­‑ ¡ 453, ¡1970 ¡

  • Alec ¡J. ¡Jefferys, ¡Victoria ¡Wilson, ¡and ¡Swee ¡Lay ¡Thein. ¡Hypervariable ¡'minisatellite' ¡regions ¡in ¡human ¡
  • DNA. ¡Nature, ¡314:67-­‑73, ¡1985. ¡