====== Week 12: Debugging and Unit Testing ====== ===== Objectives ===== * Teach effective ways to find bugs in programs. * Motivate students to adequately test their programs. ===== Readings for Class Discussion ===== * Christensen (2008). [[http://www.springerlink.com/content/1142023521204862/|Experiences with a Focus on Testing in Teaching]]. BCK. * McCauley (2008). [[http://www.tandfonline.com/doi/abs/10.1080/08993400802114581|Debugging: A Review of the Literature from an Educational Perspective]]. Optional: * Ahmadzadeh (2005). An Analysis of Patterns of Debugging Among Computer Science Students. * Murphy (2010). Pair Debugging: A Transactive Discourse Analysis. ===== Topics ===== * Programming by testing first * Using a debugger (Java vs. C/C++) * Keys to debugging (from Horstmann, Chapter 6): * breakpoints * single-stepping * inspecting variables * Assertions and invariants * Unit testing * Code coverage and creating test cases ===== Lab ====== * AP CS: Locate sections in Horstmann related to debugging and testing * JUnit testing in Eclipse (http://www.eclipse.org) * JSwat (http://www.bluemarsh.com/java/jswat)