CHASE 2012 - An Exploratory Study of Backtracking Strategies Used by Developers

YoungSeok Yoon
YoungSeok YoonGraduate Student
An Exploratory Study of
         Backtracking Strategies
          Used by Developers
                  YoungSeok Yoon (youngseok@cs.cmu.edu)
                  Institute for Software Research (ISR)

                  Brad A. Myers (bam@cs.cmu.edu)
                  Human-Computer Interaction Institute (HCII)


 CHASE 2012              School of Computer Science
June 2nd, 2012.          Carnegie Mellon University
What is Backtracking?
• When developers write source code, they often need
  to step back when something goes wrong

• We define backtracking as:

          going back to an earlier state of
          at least some part of the code,
          either by removing inserted code
          or by restoring removed code

                        CHASE 2012                 2
Examples of Backtracking
Correcting minor mistakes


        Tuning parameters

            Trying out methods
      while learning an unfamiliar API
        Experimenting with different classes
              (e.g. UI layout classes)



                  CHASE 2012                   3
Existing Support for Backtracking




              CHASE 2012            4
Existing Support for Backtracking




Conventional Undo Command
• Only works for the most recent changes
• Have to undo all changes in order
• Undone changes are thrown away after making a new edit

                        CHASE 2012                         5
Existing Support for Backtracking




Version Control
• The desired version needs to be committed in advance
• Unstable code should not be committed to the repository
• Inappropriate when wanted and unwanted code is mixed

                         CHASE 2012                         6
Existing Support for Backtracking




Manual Edit / Commenting Out
• Have to manually find all the relevant code
• Redo the work by hand


                          CHASE 2012            7
Research Question
As a first step towards
supporting more robust backtracking tools…


   How can we better understand
 developers' backtracking behaviors?



                       CHASE 2012            8
STUDY #1.
LAB STUDY


   CHASE 2012   9
Study Settings
• 12 participants, all MS/PhD students at CMU
• 2 hrs, THINK ALOUD
• Code base: Paint program [Ko 2005][Fogarty 2005]




                       CHASE 2012                    10
Tasks
• Two sets of features each done in two different ways,
   ▪ intended to lead participants to backtrack

      Feature 1 (F1)                          Feature 2 (F2)
    “Thickness Control”                  “X, Y coordinates indicator”

           F1-1                                     F2-1



           F1-2                                     F2-2



                            CHASE 2012                                  11
Commenting Out
• 7 out of 12 participants preferred to comment out
  rather than to delete code

• 3 main reasons for commenting out

     Reuse                 Good                   Bad
     later                example               example
  e.g. activating one    leave the code as a   remind themselves
 alternative at a time      good example        that the code was
                                                     not good

                              CHASE 2012                            12
Problems while Backtracking
• Difficulties in finding relevant code fragments that
  have to be reverted when:
   ▪ there are two or more similar looking code fragments
   ▪ relevant code fragments are scattered across multiple
     locations


• Forgetting to remove temporary code
   ▪ e.g., Debug output statements such as:
      • System.out.println
      • JOptionPane.showMessageDialog

                            CHASE 2012                       13
Backtracking as Restoring Code
• 2 participants accidentally deleted some code

• One participant failed to restore the code from
  memory after spending about 10 mins.

• The other succeeded using the undo command
  because he knew:
   ▪ what the code looked like
   ▪ that it was deleted very recently

                             CHASE 2012             14
Backtracking as Restoring Code
• When trying to restore deleted code, participants often
  remembered some features about the desired code
   ▪   the original location of the code
   ▪   the surrounding code
   ▪   the names of some code elements (variable, method, …)
   ▪   what the code looked like


• Participants also reproduced the same code fragments from
  memory repeatedly
   ▪ e.g. complex formatted string looking like

                  “(X, Y) = ” + x + “, ” + y + “)”
                                 CHASE 2012                    15
STUDY #2.
ONLINE SURVEY


     CHASE 2012   16
Demographics

Female                 • 48 professional
  8%
                         programmers


         Male          • 13 yrs exp. on average
         92%

                       • recruited from online
                         developer communities


                CHASE 2012                        17
Flexibility of their work
                                                                      Highly specified before I
    The results that my code                                          start developing
           achieves


 The architecture of the code                                         Specified, but some
            itself                                                    opportunity to negotiate
                                                                      changes

Which APIs/libraries are used                                         Somewhat flexible, within
                                                                      broad constraints

  Which elements of the API
          are used                                                    Highly flexible


          The details of the
        implementation code                                           Completely unspecified; I
                                                                      can do whatever I want
                                0%   20%   40%     60%   80%   100%




                                           CHASE 2012                                             18
How often do they have to backtrack?

                   Tuning parameters
                                                                                     All the time
       Figuring out how to use an API
                  correctly
                                                                                     Frequently

 Fixing code just added, because it is
              not working                                                            Sometimes

      Trying out various user interface
                  designs                                                            Rarely


Trying to find an appropriate algorithm                                              Never

                                          0%     20%        40%   60%   80%   100%




                                               CHASE 2012                                      19
Backtracking Strategies
• For each backtracking situation, only a few strategies
  were primarily used
   ▪ e.g. “select & overtype” when tuning parameters
   ▪ This hints at how to detect a certain backtracking situation


• Other strategies in the open-ended responses
   ▪   using Boolean variables to temporarily turn on/off code
   ▪   writing a small code snippet (outside the main project)
   ▪   moving parameters out of the code
   ▪   writing unit tests to see how the API works
                              CHASE 2012                         20
Future Work
• Conducting an extended version of this study
   ▪ A field study is ongoing, using our Eclipse logging tool
     called FLUORITE [Yoon 2011]
   ▪ If you are interested in participating, please let me know!


• Designing new backtracking tools, based on the
  needs identified in these studies




                             CHASE 2012                            21
Conclusion
• Backtracking happens a lot while coding

• The backtracking strategies used by developers are
  still manual and error-prone

• Better backtracking tools would help developers
  write code more correctly and effectively



                        CHASE 2012                     22
Questions?
Contact Info: YoungSeok Yoon
              E-mail: youngseok@cs.cmu.edu
              Web: http://www.cs.cmu.edu/~yyoon1/

             FLUORITE logging tool can be found at:
             http://www.cs.cmu.edu/~fluorite/

             Thanks for funding from:




                       CHASE 2012                     23
1 of 23

Recommended

Online performance modeling and analysis of message-passing parallel applicat... by
Online performance modeling and analysis of message-passing parallel applicat...Online performance modeling and analysis of message-passing parallel applicat...
Online performance modeling and analysis of message-passing parallel applicat...MOCA Platform
610 views77 slides
Aspect Oriented Programming by
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented ProgrammingAnumod Kumar
5.5K views20 slides
Testing in the lifecycle by
Testing in the lifecycleTesting in the lifecycle
Testing in the lifecycleHoang Nguyen
1.1K views61 slides
Client Side Unit Testing by
Client Side Unit TestingClient Side Unit Testing
Client Side Unit Testingcloud chen
1.5K views156 slides
Comp102 lec 1 by
Comp102   lec 1Comp102   lec 1
Comp102 lec 1Fraz Bakhsh
682 views52 slides
Discovery Life Project Portfolio by
Discovery Life Project PortfolioDiscovery Life Project Portfolio
Discovery Life Project PortfolioJaco Koekemoer
72 views7 slides

More Related Content

Similar to CHASE 2012 - An Exploratory Study of Backtracking Strategies Used by Developers

Refactoring workshop by
Refactoring workshop Refactoring workshop
Refactoring workshop Itzik Saban
606 views134 slides
Eurosport's Kodakademi #2 by
Eurosport's Kodakademi #2Eurosport's Kodakademi #2
Eurosport's Kodakademi #2Benjamin Baumann
98 views23 slides
The View - Lotusscript coding best practices by
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practicesBill Buchan
3.5K views72 slides
Code reviews by
Code reviewsCode reviews
Code reviewsRoger Xia
755 views23 slides
Software development lifecycle by
Software development lifecycleSoftware development lifecycle
Software development lifecyclenicky_walters
2.2K views12 slides
Amanda Cinnamon - Treat Your Code Like the Valuable Software It Is by
Amanda Cinnamon - Treat Your Code Like the Valuable Software It IsAmanda Cinnamon - Treat Your Code Like the Valuable Software It Is
Amanda Cinnamon - Treat Your Code Like the Valuable Software It IsRehgan Avon
150 views28 slides

Similar to CHASE 2012 - An Exploratory Study of Backtracking Strategies Used by Developers(20)

Refactoring workshop by Itzik Saban
Refactoring workshop Refactoring workshop
Refactoring workshop
Itzik Saban606 views
The View - Lotusscript coding best practices by Bill Buchan
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practices
Bill Buchan3.5K views
Code reviews by Roger Xia
Code reviewsCode reviews
Code reviews
Roger Xia755 views
Software development lifecycle by nicky_walters
Software development lifecycleSoftware development lifecycle
Software development lifecycle
nicky_walters2.2K views
Amanda Cinnamon - Treat Your Code Like the Valuable Software It Is by Rehgan Avon
Amanda Cinnamon - Treat Your Code Like the Valuable Software It IsAmanda Cinnamon - Treat Your Code Like the Valuable Software It Is
Amanda Cinnamon - Treat Your Code Like the Valuable Software It Is
Rehgan Avon150 views
Orthogonality: A Strategy for Reusable Code by rsebbe
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Code
rsebbe1.6K views
Improving The Quality of Existing Software by Steven Smith
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
Steven Smith2.9K views
SE2016 Java Alex Theedom "Java EE revisits design patterns" by Inhacking
SE2016 Java Alex Theedom "Java EE revisits design patterns"SE2016 Java Alex Theedom "Java EE revisits design patterns"
SE2016 Java Alex Theedom "Java EE revisits design patterns"
Inhacking143 views
Devconf 2011 - PHP - How Yii framework is developed by Alexander Makarov
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
Introducing systems analysis, design & development Concepts by Shafiul Azam Chowdhury
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
Reviewing CPAN modules by neilbowers
Reviewing CPAN modulesReviewing CPAN modules
Reviewing CPAN modules
neilbowers514 views
Capability Building for Cyber Defense: Software Walk through and Screening by Maven Logix
Capability Building for Cyber Defense: Software Walk through and Screening Capability Building for Cyber Defense: Software Walk through and Screening
Capability Building for Cyber Defense: Software Walk through and Screening
Maven Logix 95 views
Test driven development - Zombie proof your code by Pascal Larocque
Test driven development - Zombie proof your codeTest driven development - Zombie proof your code
Test driven development - Zombie proof your code
Pascal Larocque1.4K views

Recently uploaded

Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...ShapeBlue
113 views18 slides
Cencora Executive Symposium by
Cencora Executive SymposiumCencora Executive Symposium
Cencora Executive Symposiummarketingcommunicati21
106 views14 slides
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...ShapeBlue
114 views12 slides
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...ShapeBlue
59 views13 slides
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsShapeBlue
172 views13 slides
NTGapps NTG LowCode Platform by
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform Mustafa Kuğu
287 views30 slides

Recently uploaded(20)

Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue113 views
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue114 views
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue59 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue172 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu287 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue75 views
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda... by ShapeBlue
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
Hypervisor Agnostic DRS in CloudStack - Brief overview & demo - Vishesh Jinda...
ShapeBlue93 views
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... by ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue52 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue86 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely76 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue147 views
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue178 views
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue97 views
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue120 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty54 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 views

CHASE 2012 - An Exploratory Study of Backtracking Strategies Used by Developers

  • 1. An Exploratory Study of Backtracking Strategies Used by Developers YoungSeok Yoon (youngseok@cs.cmu.edu) Institute for Software Research (ISR) Brad A. Myers (bam@cs.cmu.edu) Human-Computer Interaction Institute (HCII) CHASE 2012 School of Computer Science June 2nd, 2012. Carnegie Mellon University
  • 2. What is Backtracking? • When developers write source code, they often need to step back when something goes wrong • We define backtracking as: going back to an earlier state of at least some part of the code, either by removing inserted code or by restoring removed code CHASE 2012 2
  • 3. Examples of Backtracking Correcting minor mistakes Tuning parameters Trying out methods while learning an unfamiliar API Experimenting with different classes (e.g. UI layout classes) CHASE 2012 3
  • 4. Existing Support for Backtracking CHASE 2012 4
  • 5. Existing Support for Backtracking Conventional Undo Command • Only works for the most recent changes • Have to undo all changes in order • Undone changes are thrown away after making a new edit CHASE 2012 5
  • 6. Existing Support for Backtracking Version Control • The desired version needs to be committed in advance • Unstable code should not be committed to the repository • Inappropriate when wanted and unwanted code is mixed CHASE 2012 6
  • 7. Existing Support for Backtracking Manual Edit / Commenting Out • Have to manually find all the relevant code • Redo the work by hand CHASE 2012 7
  • 8. Research Question As a first step towards supporting more robust backtracking tools… How can we better understand developers' backtracking behaviors? CHASE 2012 8
  • 9. STUDY #1. LAB STUDY CHASE 2012 9
  • 10. Study Settings • 12 participants, all MS/PhD students at CMU • 2 hrs, THINK ALOUD • Code base: Paint program [Ko 2005][Fogarty 2005] CHASE 2012 10
  • 11. Tasks • Two sets of features each done in two different ways, ▪ intended to lead participants to backtrack Feature 1 (F1) Feature 2 (F2) “Thickness Control” “X, Y coordinates indicator” F1-1 F2-1 F1-2 F2-2 CHASE 2012 11
  • 12. Commenting Out • 7 out of 12 participants preferred to comment out rather than to delete code • 3 main reasons for commenting out Reuse Good Bad later example example e.g. activating one leave the code as a remind themselves alternative at a time good example that the code was not good CHASE 2012 12
  • 13. Problems while Backtracking • Difficulties in finding relevant code fragments that have to be reverted when: ▪ there are two or more similar looking code fragments ▪ relevant code fragments are scattered across multiple locations • Forgetting to remove temporary code ▪ e.g., Debug output statements such as: • System.out.println • JOptionPane.showMessageDialog CHASE 2012 13
  • 14. Backtracking as Restoring Code • 2 participants accidentally deleted some code • One participant failed to restore the code from memory after spending about 10 mins. • The other succeeded using the undo command because he knew: ▪ what the code looked like ▪ that it was deleted very recently CHASE 2012 14
  • 15. Backtracking as Restoring Code • When trying to restore deleted code, participants often remembered some features about the desired code ▪ the original location of the code ▪ the surrounding code ▪ the names of some code elements (variable, method, …) ▪ what the code looked like • Participants also reproduced the same code fragments from memory repeatedly ▪ e.g. complex formatted string looking like “(X, Y) = ” + x + “, ” + y + “)” CHASE 2012 15
  • 16. STUDY #2. ONLINE SURVEY CHASE 2012 16
  • 17. Demographics Female • 48 professional 8% programmers Male • 13 yrs exp. on average 92% • recruited from online developer communities CHASE 2012 17
  • 18. Flexibility of their work Highly specified before I The results that my code start developing achieves The architecture of the code Specified, but some itself opportunity to negotiate changes Which APIs/libraries are used Somewhat flexible, within broad constraints Which elements of the API are used Highly flexible The details of the implementation code Completely unspecified; I can do whatever I want 0% 20% 40% 60% 80% 100% CHASE 2012 18
  • 19. How often do they have to backtrack? Tuning parameters All the time Figuring out how to use an API correctly Frequently Fixing code just added, because it is not working Sometimes Trying out various user interface designs Rarely Trying to find an appropriate algorithm Never 0% 20% 40% 60% 80% 100% CHASE 2012 19
  • 20. Backtracking Strategies • For each backtracking situation, only a few strategies were primarily used ▪ e.g. “select & overtype” when tuning parameters ▪ This hints at how to detect a certain backtracking situation • Other strategies in the open-ended responses ▪ using Boolean variables to temporarily turn on/off code ▪ writing a small code snippet (outside the main project) ▪ moving parameters out of the code ▪ writing unit tests to see how the API works CHASE 2012 20
  • 21. Future Work • Conducting an extended version of this study ▪ A field study is ongoing, using our Eclipse logging tool called FLUORITE [Yoon 2011] ▪ If you are interested in participating, please let me know! • Designing new backtracking tools, based on the needs identified in these studies CHASE 2012 21
  • 22. Conclusion • Backtracking happens a lot while coding • The backtracking strategies used by developers are still manual and error-prone • Better backtracking tools would help developers write code more correctly and effectively CHASE 2012 22
  • 23. Questions? Contact Info: YoungSeok Yoon E-mail: youngseok@cs.cmu.edu Web: http://www.cs.cmu.edu/~yyoon1/ FLUORITE logging tool can be found at: http://www.cs.cmu.edu/~fluorite/ Thanks for funding from: CHASE 2012 23