Home > Articles

  • Print
  • + Share This
This chapter is from the book

Item 11: Minimize the Turnaround Time from Your Changes to Their Result

Debugging is often a process of successive approximation. The time you wait (again and again) for the software to build, run, and fail, and the time you spend (again and again) to cajole it to go through these steps is time you don’t devote in solving your problem. Therefore, early on, invest in minimizing the time it takes to go through a debug cycle.

Start with the software build. You should be able to quickly build the failing software with a single command or keystroke, such as make, mvn compile, or F5. The build process should track dependencies between files ensuring that only a few files get compiled after you change something. Tools that can help you here include make, Ant, and Maven.

The efficient deploying and running of the software is equally important. The steps here vary a lot between projects. You may need to deploy files on a remote host, restart an application server, clear caches, or reinitialize a database. Use the project’s build system or write some scripts to automate this process (see Item 12: “Automate Complex Testing Scenarios”). If a typical installation of your software involves a protracted construction of a distribution file and its subsequent slow installation, setup a shortcut where you only copy the modified files to their final location.

Finally, ensure that the software will quickly fail (see Item 55: “Fail Fast”). If the failing code comes with unit tests or a regression-testing framework, build a test case that demonstrates the specific failure (see Item 10: “Enable the Efficient Reproduction of the Problem”). Then use features of your IDE or testing environment to run the specific test case. For instance, under Maven you can run the TestFetch case with the following command.

mvn -Dtest=TestFetch test

If the program you’re debugging can be made to fail by processing a specific file, then construct a minimal file that can trigger this failure. To replicate problems in GUI applications, you can use software automation applications, such as Selenium for web browsers, AutoHotkey for Windows, Automator for OS X, and AutoKey for Linux.

Things to Remember

  • A fast turnaround time increases your effectiveness.

  • Set up a fast automated build and deployment process.

  • Minimize the time it takes for your tests to fail.

  • + Share This
  • 🔖 Save To Your Account