SlideShare a Scribd company logo
1 of 31
Trends in Code
100

 75                      Yana Momchilova Mileva
 50                      Saarland University, Germany
 25
                         Advisor: Prof. Andreas Zeller
  0
   2001 2003 2005 2007
Google Zeitgeist
Nov 4, 2008                                “david plouffe”

 1. mccain concession speech
 2. david plouffe
 3. uncle tom
 4. did prop 8 pass
 5. mccain concedes
 6. obama acceptance speech
 7. david pluff
 8. california election results 2008
 9. obama elected president
10. obama campaign manager




                                       2
The Code Evolves
             Lines of Code
  30,000

  22,500

  15,000

   7,500

      0
       1999 2001 2003 2005 2007
               Rhino




                 3
The Questions
   How does this affect the future of the code?


   Evolution of code has an impact on the system.


Can this evolution information prevent code defects?



                         4
Evolution of Features
     • Variables
     • Import statements
     • Packages
     • Method calls
     • Word Stems

              5
Evolution Patterns
3,000                  600                  300
2,250                  450                  240
                                            180
1,500                  300
                                            120
 750                   150                   60
     0                    0                   0
      2001 2003 2005       1999 2002 2005      1999 2002 2005

20                     30.0                 500
15                     22.5                 375
10                     15.0                 250
 5                      7.5                 125
 0                       0                   0
  2001   2003   2005      1999 2002 2005      1999 2002 2005


                                 6
Google Zeitgeist
“david plouffe”       “david plouffe”




United States           Germany




                  7
All is Project-specific
     import java.util.Stack             import java.util.Stack
60                                10

45                                 8
        Popular!                   6   Old-fashioned!
30
                                   4
15                                 2

0                                  0
 2001     2003       2005           1999 2001 2003 2005

           Eclipse                            Rhino




                              8
Evolution of Features
     • Variables
     • Import statements
     • Packages
     • Method calls
     • Word Stems

              9
Import Statements
                             Number of occurrences per year in Eclipse
                                                                         Evolution
  Imported classes
                                                                         patterns
                              2001   2002   2003   2004   2005   2006

       java.util.List         455     942   1136   1631   2096   2480

        swt.layout            335     229   268    372    314    328

internal.base.model.plugin    119      0     0      0      0      0

      java.util.Stack          19     22     31     26     38     57




                                            10
Import Statements
                         Number of occurrences per year in Rhino
                                                                       Evolution
Imported classes
                                                                       patterns
                        1999 2000 2001 2002 2003 2004 2005 2006 2007

 java.io.Serializable    0    0    4    9     10   10   10   13   13

java.io.IOException     11   10    7   11     9    9    6    8    8

 java.util.Hashtable    32   32   16   12     14   14   13   13   13

   java.util.Stack       8    8    3    0     0    0    0    0    0




                                         11
Deletion Patterns
         import java.util.Stack
    10
    8
    6
    4
    2
    0
     1999 2001 2003 2005
               Rhino



                 12
What happened to Stack?
  package org.mozilla.javascript;                           package org.mozilla.javascript;
  import java.util.Stack;
  import java.util.Vector;
  ...                                                       ...
  loops = new Stack ();                                     loops = new ObjArray ();
  ...                                                       ...
  for (int i = loops.size()-1; i >= 0; i--) {               for (int i = loops.size()-1; i >= 0; i--) {
     Node n = (Node) loops.elementAt(i);                       Node n = (Node) loops.get(i);
     if (n.getType() == TokenStream.LABEL) {                   if (n.getType() == TokenStream.LABEL) {
     ...                                                       ...
     }                                                         }
  }                                                         }




Commit message: “I replaced Stack by ObjArray... It avoids unnecessary synchronization and save memory. To
simplify the replacement I added to ObjArray and ObjToIntMap few utility methods.”




                                                   13
Evolution of Features
     • Variables
     • Import statements
     • Packages
     • Method calls
     • Word Stems

              14
Method Calls
                        Number of occurrences per year in Eclipse
                                                                    Evolution
  Method name
                                                                    patterns
                         2001   2002   2003   2004   2005   2006

      append ( )         4522   11473 20215 30658 40169     46913

getMinorComponent ( )     20     18     34     33     20     24

   getVersionStr ( )      53     25     25     0      0       0

getModifiedElement ( )     3       3     0      10     16     17




                                       15
Method Calls
                       Number of occurrences per year in Rhino
                                                                          Evolution
 Method name
                                                                          patterns
                      1999 2000 2001 2002 2003 2004 2005 2006 2007

  getProperty ( )      2    8   10    20    28    37    37    37    41

 addByteCode ( )      248 220   108   106    0     0    0      0     0

reportConvError ( )   30   30   16     0     0    17    17    17    17

    charAt ( )        209 242   127   132   140   144   146   147   177




                                       16
Method Calls Deletion
      classFile = new ClassFileWriter (generatedClassName, superClassName, itsSourceFile);
      ...
      for (int i = 0; i< scriptOrFn.getParamCount ( ); i++) {
          push (i);
          addByteCode (ByteCode.ALOAD, 4);
          ...
      }
      ...
      private void addByteCode (byte theOpcode){
          classFile.add(theOpcode);
      }



Commit message: “Renaming Codegen.classFile to Codegen.cfw and removal of methods like push/
load/store/add in favour of directly calling ClassFileMethods.”

      cfw = new ClassFileWriter (generatedClassName, superClassName, itsSourceFile);
      ...
      for (int i = 0; i< scriptOrFn.getParamCount ( ); i++) {
          cfw.addPush (i);
          cfw.add (ByteCode.ALOAD, 4);
          ...
      }



                                              17
Evolution of Features

     • Variables
     • Import statements
     • Packages
     • Method calls
     • Word Stems getName = {get, name}
             18
Word Stems
              Number of occurrences per year in Rhino
                                                                 Evolution
Word stems
                                                                 patterns
             1999 2000 2001 2002 2003 2004 2005 2006 2007

   get       3626 3750 1775 1803 1640 1474 1493 1502 1647

    set      488 488   259   316   303   291   292   297   318

  feature     0    0   12    16    13    21    21    23    32

  system      2    2    0     0     0     0    0      1     3




                              19
Learning from Evolution
                 tokens
 tokens db                              deletion
                evolution                                       program
(CVS data)                              patterns
                analyzer




                             point to
                                                    patterns
                              defect
                                                   violations
                            locations



                               20
     Tokens
   (CVS data)
Learning from Evolution
                 tokens
 tokens db                             deletion
                evolution
(CVS data)                             patterns
                analyzer




                             issue a               patterns
                            warning!              violations




                               21
     Tokens
   (CVS data)
Combining Patterns
      getNextSibling ( )           Combined Patterns                 getNext ( )
300                          300                           150

225                          225
                                                           100
150                          150
                                                            50
 75                           75

 0                             0                             0
  1999 2001 2003 2005 2007      1999 2001 2003 2005 2007      1999 2001 2003 2005 2007
           Rhino                                                       Rhino


                           Detected a Substitution!
                                         22
Combining Patterns
                  token          old token               new token         # substitutions
                   type
                   m call       getNextSibling             getNext               12
    Rhino         m call           getShort                getIndex               8
 (31 in total)    m call    generateCodeFromNode generateExpression               8
                  m call         reportError           reportSyntaxError          9
                                                 ...
                  m call         addVariable             addReslover             48
                  m call       outputDelimiter             outputIn              29
   Eclipse
                  m call           gtk_new             gtk_new_system            18
(1864 in total)
                  m call          getString             translateString          16
                                                 ...




                                          23
Combining Patterns
...                                                       ...
Node lhs = n.getFirstChild();                             Node lhs = n.getFirstChild();
Node rhs = lhs.getNextSibling();                          Node rhs = lhs.getNext();
lookForVariablesAndCalls(rhs, liveSet, theVariables);     lookForVariablesAndCalls(rhs, liveSet, theVariables);
...                                                       ...


           300                                                       150
           225
                                                                     100
           150
             75                                                       50
              0                                                         0
               1999 2002 2005                                            1999 2002 2005


     Commit message: “ I removed method duplication in Node where getNext() was duplicated as
     getNextSibling() and code was using both of them and similarly for getFirstChild()/getFirst().”



                                                     24
Learning from Evolution
                  tokens
 tokens db                              combined
                                         deletion
                 evolution
(CVS data)                               patterns
                 analyzer




      recommend               issue a                patterns
      substitution           warning!               violations




                                25
Future tokens list
 Extend the
            Work
 • Variables
 • Import statements
 • Packages
 • Method calls
 • Word Stems
 • More features
          26
FuturedoWork
                  Context matter

                   getShort( )           getIndex( )
                            (replaced in Rhino)

                ...
                case LINE_ICODE: {
                     int line = getShort (iCode, pc + 1);
                  ...
                }
                ...



In 100% of the places where ‘LINE_ICODE’ was used, getShort( )
                was not replaced by getIndex( ).


                                    27
Future Work
                  Program Analysis Features



...                                     ...
scriptOrFn.getParamCount ( );           addByteCode (ByteCode.ALOAD, 4);
addByteCode (ByteCode.ALOAD, 4);        scriptOrFn.getParamCount ( );
...                                     ...




    Evolution and trends of sequence of method calls




                                   28
Planned Evaluation
•   Training and testing data sets:

    •   learn evolution patterns from the training set;

    •   predicting deletions in the testing set.

•   Recommendation tool, perform user studies:

    •   open-source community;

    •   closed-source community.


                             29
Related Work
          Thomas Zimmermann




                    Beat Fluri




                         Stephan Diehl




     30
Summary
                                                                                         Evolution Patterns
                                                                             3,000                  600                  300
                                                                             2,250                  450                  240
                                                                                                                         180
                                                                             1,500                  300
                                                                                                                         120
                                                                              750                   150                   60
                                                                                  0                    0                   0
                                                                                   2001 2003 2005       1999 2002 2005      1999 2002 2005

                                                                             20                     30.0                 500
                                                                             15                     22.5                 375
                                                                             10                     15.0                 250
                                                                              5                      7.5                 125
                                                                              0                       0                   0
                                                                               2001   2003   2005      1999 2002 2005      1999 2002 2005


                                                                                                              5




Learning from Evolution
               tokens
 tokens db                            deletion
              evolution                                       program
(CVS data)                            patterns
              analyzer




                           point to
                                                  patterns
                            defect
                                                 violations
                          locations



                             18
     Tokens




                                                                        31

More Related Content

Similar to FSE'08 Doctoral Symposium

4 Node.js Gotchas: What your ops team needs to know
4 Node.js Gotchas: What your ops team needs to know4 Node.js Gotchas: What your ops team needs to know
4 Node.js Gotchas: What your ops team needs to knowDynatrace
 
Universal Applications
Universal ApplicationsUniversal Applications
Universal ApplicationsFITC
 
運用CNTK 實作深度學習物件辨識 Deep Learning based Object Detection with Microsoft Cogniti...
運用CNTK 實作深度學習物件辨識 Deep Learning based Object Detection with Microsoft Cogniti...運用CNTK 實作深度學習物件辨識 Deep Learning based Object Detection with Microsoft Cogniti...
運用CNTK 實作深度學習物件辨識 Deep Learning based Object Detection with Microsoft Cogniti...Herman Wu
 
Back To The Future
Back To The FutureBack To The Future
Back To The FutureBill Scott
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemGuardSquare
 
Test-driven Development Practices in White Box Test Automation
Test-driven Development Practices in White Box Test AutomationTest-driven Development Practices in White Box Test Automation
Test-driven Development Practices in White Box Test Automationervinloh
 
[第34回 WBA若手の会勉強会] Microsoft AI platform
[第34回 WBA若手の会勉強会] Microsoft AI platform[第34回 WBA若手の会勉強会] Microsoft AI platform
[第34回 WBA若手の会勉強会] Microsoft AI platformNaoki (Neo) SATO
 
EMF.Edit the Force Unleashed!
EMF.Edit the Force Unleashed!EMF.Edit the Force Unleashed!
EMF.Edit the Force Unleashed!mikaelbarbero
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...University of Antwerp
 
Tdd & clean code
Tdd & clean codeTdd & clean code
Tdd & clean codeEyal Vardi
 
MongoUK 2011 - Rplacing RabbitMQ with MongoDB
MongoUK 2011 - Rplacing RabbitMQ with MongoDBMongoUK 2011 - Rplacing RabbitMQ with MongoDB
MongoUK 2011 - Rplacing RabbitMQ with MongoDBBoxed Ice
 
The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181Mahmoud Samir Fayed
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJiayun Zhou
 
DynaMine: Finding Common Error Patterns by Mining Software Revision Histories
DynaMine: Finding Common Error Patterns by Mining Software Revision HistoriesDynaMine: Finding Common Error Patterns by Mining Software Revision Histories
DynaMine: Finding Common Error Patterns by Mining Software Revision HistoriesThomas Zimmermann
 
Machine Learning Model Bakeoff
Machine Learning Model BakeoffMachine Learning Model Bakeoff
Machine Learning Model Bakeoffmrphilroth
 
Business model ปูนนครหลวง1
Business model ปูนนครหลวง1Business model ปูนนครหลวง1
Business model ปูนนครหลวง1Nunuy Piyachat
 
Come for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolvesCome for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolvesGábor Hojtsy
 
CCLLC Firm Intro
CCLLC Firm IntroCCLLC Firm Intro
CCLLC Firm IntroTony Latona
 

Similar to FSE'08 Doctoral Symposium (20)

4 Node.js Gotchas: What your ops team needs to know
4 Node.js Gotchas: What your ops team needs to know4 Node.js Gotchas: What your ops team needs to know
4 Node.js Gotchas: What your ops team needs to know
 
Universal Applications
Universal ApplicationsUniversal Applications
Universal Applications
 
運用CNTK 實作深度學習物件辨識 Deep Learning based Object Detection with Microsoft Cogniti...
運用CNTK 實作深度學習物件辨識 Deep Learning based Object Detection with Microsoft Cogniti...運用CNTK 實作深度學習物件辨識 Deep Learning based Object Detection with Microsoft Cogniti...
運用CNTK 實作深度學習物件辨識 Deep Learning based Object Detection with Microsoft Cogniti...
 
Back To The Future
Back To The FutureBack To The Future
Back To The Future
 
Eric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build systemEric Lafortune - The Jack and Jill build system
Eric Lafortune - The Jack and Jill build system
 
Test-driven Development Practices in White Box Test Automation
Test-driven Development Practices in White Box Test AutomationTest-driven Development Practices in White Box Test Automation
Test-driven Development Practices in White Box Test Automation
 
Continuous Testing
Continuous TestingContinuous Testing
Continuous Testing
 
[第34回 WBA若手の会勉強会] Microsoft AI platform
[第34回 WBA若手の会勉強会] Microsoft AI platform[第34回 WBA若手の会勉強会] Microsoft AI platform
[第34回 WBA若手の会勉強会] Microsoft AI platform
 
EMF.Edit the Force Unleashed!
EMF.Edit the Force Unleashed!EMF.Edit the Force Unleashed!
EMF.Edit the Force Unleashed!
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
Finding Bugs, Fixing Bugs, Preventing Bugs - Exploiting Automated Tests to In...
 
Tdd & clean code
Tdd & clean codeTdd & clean code
Tdd & clean code
 
MongoUK 2011 - Rplacing RabbitMQ with MongoDB
MongoUK 2011 - Rplacing RabbitMQ with MongoDBMongoUK 2011 - Rplacing RabbitMQ with MongoDB
MongoUK 2011 - Rplacing RabbitMQ with MongoDB
 
The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSF
 
DynaMine: Finding Common Error Patterns by Mining Software Revision Histories
DynaMine: Finding Common Error Patterns by Mining Software Revision HistoriesDynaMine: Finding Common Error Patterns by Mining Software Revision Histories
DynaMine: Finding Common Error Patterns by Mining Software Revision Histories
 
Machine Learning Model Bakeoff
Machine Learning Model BakeoffMachine Learning Model Bakeoff
Machine Learning Model Bakeoff
 
Business model ปูนนครหลวง1
Business model ปูนนครหลวง1Business model ปูนนครหลวง1
Business model ปูนนครหลวง1
 
Come for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolvesCome for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolves
 
CCLLC Firm Intro
CCLLC Firm IntroCCLLC Firm Intro
CCLLC Firm Intro
 

Recently uploaded

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 

Recently uploaded (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 

FSE'08 Doctoral Symposium

  • 1. Trends in Code 100 75 Yana Momchilova Mileva 50 Saarland University, Germany 25 Advisor: Prof. Andreas Zeller 0 2001 2003 2005 2007
  • 2. Google Zeitgeist Nov 4, 2008 “david plouffe” 1. mccain concession speech 2. david plouffe 3. uncle tom 4. did prop 8 pass 5. mccain concedes 6. obama acceptance speech 7. david pluff 8. california election results 2008 9. obama elected president 10. obama campaign manager 2
  • 3. The Code Evolves Lines of Code 30,000 22,500 15,000 7,500 0 1999 2001 2003 2005 2007 Rhino 3
  • 4. The Questions How does this affect the future of the code? Evolution of code has an impact on the system. Can this evolution information prevent code defects? 4
  • 5. Evolution of Features • Variables • Import statements • Packages • Method calls • Word Stems 5
  • 6. Evolution Patterns 3,000 600 300 2,250 450 240 180 1,500 300 120 750 150 60 0 0 0 2001 2003 2005 1999 2002 2005 1999 2002 2005 20 30.0 500 15 22.5 375 10 15.0 250 5 7.5 125 0 0 0 2001 2003 2005 1999 2002 2005 1999 2002 2005 6
  • 7. Google Zeitgeist “david plouffe” “david plouffe” United States Germany 7
  • 8. All is Project-specific import java.util.Stack import java.util.Stack 60 10 45 8 Popular! 6 Old-fashioned! 30 4 15 2 0 0 2001 2003 2005 1999 2001 2003 2005 Eclipse Rhino 8
  • 9. Evolution of Features • Variables • Import statements • Packages • Method calls • Word Stems 9
  • 10. Import Statements Number of occurrences per year in Eclipse Evolution Imported classes patterns 2001 2002 2003 2004 2005 2006 java.util.List 455 942 1136 1631 2096 2480 swt.layout 335 229 268 372 314 328 internal.base.model.plugin 119 0 0 0 0 0 java.util.Stack 19 22 31 26 38 57 10
  • 11. Import Statements Number of occurrences per year in Rhino Evolution Imported classes patterns 1999 2000 2001 2002 2003 2004 2005 2006 2007 java.io.Serializable 0 0 4 9 10 10 10 13 13 java.io.IOException 11 10 7 11 9 9 6 8 8 java.util.Hashtable 32 32 16 12 14 14 13 13 13 java.util.Stack 8 8 3 0 0 0 0 0 0 11
  • 12. Deletion Patterns import java.util.Stack 10 8 6 4 2 0 1999 2001 2003 2005 Rhino 12
  • 13. What happened to Stack? package org.mozilla.javascript; package org.mozilla.javascript; import java.util.Stack; import java.util.Vector; ... ... loops = new Stack (); loops = new ObjArray (); ... ... for (int i = loops.size()-1; i >= 0; i--) { for (int i = loops.size()-1; i >= 0; i--) { Node n = (Node) loops.elementAt(i); Node n = (Node) loops.get(i); if (n.getType() == TokenStream.LABEL) { if (n.getType() == TokenStream.LABEL) { ... ... } } } } Commit message: “I replaced Stack by ObjArray... It avoids unnecessary synchronization and save memory. To simplify the replacement I added to ObjArray and ObjToIntMap few utility methods.” 13
  • 14. Evolution of Features • Variables • Import statements • Packages • Method calls • Word Stems 14
  • 15. Method Calls Number of occurrences per year in Eclipse Evolution Method name patterns 2001 2002 2003 2004 2005 2006 append ( ) 4522 11473 20215 30658 40169 46913 getMinorComponent ( ) 20 18 34 33 20 24 getVersionStr ( ) 53 25 25 0 0 0 getModifiedElement ( ) 3 3 0 10 16 17 15
  • 16. Method Calls Number of occurrences per year in Rhino Evolution Method name patterns 1999 2000 2001 2002 2003 2004 2005 2006 2007 getProperty ( ) 2 8 10 20 28 37 37 37 41 addByteCode ( ) 248 220 108 106 0 0 0 0 0 reportConvError ( ) 30 30 16 0 0 17 17 17 17 charAt ( ) 209 242 127 132 140 144 146 147 177 16
  • 17. Method Calls Deletion classFile = new ClassFileWriter (generatedClassName, superClassName, itsSourceFile); ... for (int i = 0; i< scriptOrFn.getParamCount ( ); i++) { push (i); addByteCode (ByteCode.ALOAD, 4); ... } ... private void addByteCode (byte theOpcode){ classFile.add(theOpcode); } Commit message: “Renaming Codegen.classFile to Codegen.cfw and removal of methods like push/ load/store/add in favour of directly calling ClassFileMethods.” cfw = new ClassFileWriter (generatedClassName, superClassName, itsSourceFile); ... for (int i = 0; i< scriptOrFn.getParamCount ( ); i++) { cfw.addPush (i); cfw.add (ByteCode.ALOAD, 4); ... } 17
  • 18. Evolution of Features • Variables • Import statements • Packages • Method calls • Word Stems getName = {get, name} 18
  • 19. Word Stems Number of occurrences per year in Rhino Evolution Word stems patterns 1999 2000 2001 2002 2003 2004 2005 2006 2007 get 3626 3750 1775 1803 1640 1474 1493 1502 1647 set 488 488 259 316 303 291 292 297 318 feature 0 0 12 16 13 21 21 23 32 system 2 2 0 0 0 0 0 1 3 19
  • 20. Learning from Evolution tokens tokens db deletion evolution program (CVS data) patterns analyzer point to patterns defect violations locations 20 Tokens (CVS data)
  • 21. Learning from Evolution tokens tokens db deletion evolution (CVS data) patterns analyzer issue a patterns warning! violations 21 Tokens (CVS data)
  • 22. Combining Patterns getNextSibling ( ) Combined Patterns getNext ( ) 300 300 150 225 225 100 150 150 50 75 75 0 0 0 1999 2001 2003 2005 2007 1999 2001 2003 2005 2007 1999 2001 2003 2005 2007 Rhino Rhino Detected a Substitution! 22
  • 23. Combining Patterns token old token new token # substitutions type m call getNextSibling getNext 12 Rhino m call getShort getIndex 8 (31 in total) m call generateCodeFromNode generateExpression 8 m call reportError reportSyntaxError 9 ... m call addVariable addReslover 48 m call outputDelimiter outputIn 29 Eclipse m call gtk_new gtk_new_system 18 (1864 in total) m call getString translateString 16 ... 23
  • 24. Combining Patterns ... ... Node lhs = n.getFirstChild(); Node lhs = n.getFirstChild(); Node rhs = lhs.getNextSibling(); Node rhs = lhs.getNext(); lookForVariablesAndCalls(rhs, liveSet, theVariables); lookForVariablesAndCalls(rhs, liveSet, theVariables); ... ... 300 150 225 100 150 75 50 0 0 1999 2002 2005 1999 2002 2005 Commit message: “ I removed method duplication in Node where getNext() was duplicated as getNextSibling() and code was using both of them and similarly for getFirstChild()/getFirst().” 24
  • 25. Learning from Evolution tokens tokens db combined deletion evolution (CVS data) patterns analyzer recommend issue a patterns substitution warning! violations 25
  • 26. Future tokens list Extend the Work • Variables • Import statements • Packages • Method calls • Word Stems • More features 26
  • 27. FuturedoWork Context matter getShort( ) getIndex( ) (replaced in Rhino) ... case LINE_ICODE: { int line = getShort (iCode, pc + 1); ... } ... In 100% of the places where ‘LINE_ICODE’ was used, getShort( ) was not replaced by getIndex( ). 27
  • 28. Future Work Program Analysis Features ... ... scriptOrFn.getParamCount ( ); addByteCode (ByteCode.ALOAD, 4); addByteCode (ByteCode.ALOAD, 4); scriptOrFn.getParamCount ( ); ... ... Evolution and trends of sequence of method calls 28
  • 29. Planned Evaluation • Training and testing data sets: • learn evolution patterns from the training set; • predicting deletions in the testing set. • Recommendation tool, perform user studies: • open-source community; • closed-source community. 29
  • 30. Related Work Thomas Zimmermann Beat Fluri Stephan Diehl 30
  • 31. Summary Evolution Patterns 3,000 600 300 2,250 450 240 180 1,500 300 120 750 150 60 0 0 0 2001 2003 2005 1999 2002 2005 1999 2002 2005 20 30.0 500 15 22.5 375 10 15.0 250 5 7.5 125 0 0 0 2001 2003 2005 1999 2002 2005 1999 2002 2005 5 Learning from Evolution tokens tokens db deletion evolution program (CVS data) patterns analyzer point to patterns defect violations locations 18 Tokens 31