SlideShare a Scribd company logo
1 of 23
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

More Related Content

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

Refactoring workshop
Refactoring workshop Refactoring workshop
Refactoring workshop Itzik Saban
 
The View - Lotusscript coding best practices
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practicesBill Buchan
 
Code reviews
Code reviewsCode reviews
Code reviewsRoger Xia
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecyclenicky_walters
 
Amanda Cinnamon - Treat Your Code Like the Valuable Software It Is
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
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Codersebbe
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing SoftwareSteven Smith
 
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"
SE2016 Java Alex Theedom "Java EE revisits design patterns"Inhacking
 
The Power Of Refactoring (php|tek 09)
The Power Of Refactoring (php|tek 09)The Power Of Refactoring (php|tek 09)
The Power Of Refactoring (php|tek 09)Stefan Koopmanschap
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedAlexander Makarov
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsShafiul Azam Chowdhury
 
Reviewing CPAN modules
Reviewing CPAN modulesReviewing CPAN modules
Reviewing CPAN modulesneilbowers
 
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
Capability Building for Cyber Defense: Software Walk through and Screening Maven Logix
 
Techniques for Automated Software Evolution
Techniques for Automated Software EvolutionTechniques for Automated Software Evolution
Techniques for Automated Software EvolutionRaffi Khatchadourian
 
Test driven development - Zombie proof your code
Test driven development - Zombie proof your codeTest driven development - Zombie proof your code
Test driven development - Zombie proof your codePascal Larocque
 

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

Refactoring workshop
Refactoring workshop Refactoring workshop
Refactoring workshop
 
Eurosport's Kodakademi #2
Eurosport's Kodakademi #2Eurosport's Kodakademi #2
Eurosport's Kodakademi #2
 
The View - Lotusscript coding best practices
The View - Lotusscript coding best practicesThe View - Lotusscript coding best practices
The View - Lotusscript coding best practices
 
Code reviews
Code reviewsCode reviews
Code reviews
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecycle
 
Amanda Cinnamon - Treat Your Code Like the Valuable Software It Is
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
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Code
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
 
Zend Code in ZF 2.0
Zend Code in ZF 2.0Zend Code in ZF 2.0
Zend Code in ZF 2.0
 
Intro To AOP
Intro To AOPIntro To AOP
Intro To AOP
 
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"
SE2016 Java Alex Theedom "Java EE revisits design patterns"
 
Alex Theedom Java ee revisits design patterns
Alex Theedom	Java ee revisits design patternsAlex Theedom	Java ee revisits design patterns
Alex Theedom Java ee revisits design patterns
 
The Power Of Refactoring (php|tek 09)
The Power Of Refactoring (php|tek 09)The Power Of Refactoring (php|tek 09)
The Power Of Refactoring (php|tek 09)
 
Devconf 2011 - PHP - How Yii framework is developed
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
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
 
Clean code
Clean codeClean code
Clean code
 
Reviewing CPAN modules
Reviewing CPAN modulesReviewing CPAN modules
Reviewing CPAN modules
 
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
Capability Building for Cyber Defense: Software Walk through and Screening
 
Techniques for Automated Software Evolution
Techniques for Automated Software EvolutionTechniques for Automated Software Evolution
Techniques for Automated Software Evolution
 
Test driven development - Zombie proof your code
Test driven development - Zombie proof your codeTest driven development - Zombie proof your code
Test driven development - Zombie proof your code
 

Recently uploaded

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
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
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
"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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 

Recently uploaded (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
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
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
"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
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
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?
 

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