User Tools

Site Tools


software:machetedebugging

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
software:machetedebugging [2020/11/05 18:12]
solar
software:machetedebugging [2021/07/21 12:57] (current)
solar
Line 5: Line 5:
 {{:software:machetedebugging.png?300 |}} The question "why does my code not work?" is far too often accompanied by either too little or too much information. Neither facilitates good answers. Getting the amount of information right //should// be easy, but apparently isn't. This little flowchart might help. {{:software:machetedebugging.png?300 |}} The question "why does my code not work?" is far too often accompanied by either too little or too much information. Neither facilitates good answers. Getting the amount of information right //should// be easy, but apparently isn't. This little flowchart might help.
  
-The idea here is that you stop trying your code do whatever it was intended to do, and try to come up with code that displays that problem you just encountered, and does //only// that. You encounter a segfault when trying to store student data. Your mission is now no longer to enter student data (that is completely superfluous at this point, and can be slashed away ruthlessly, hence the term "Machete Debugging"). Your mission is to reproduce that segfault in as little code as possible.+The idea here is that you stop trying to make your code do whatever it was intended to do, and try to come up with code that displays that problem you just encountered, and does //only// that. You encounter a segfault when trying to store student data. Your mission is now no longer to enter student data (that is completely superfluous at this point, and can be slashed away ruthlessly, hence the term "Machete Debugging"). Your mission is to reproduce that segfault in as little code as possible.
  
 The process of reducing the size of code necessary to reproduce the problem should result in you finding the problem yourself ~80% of the time -- it is a highly educational process. Programming errors can usually be reproduced in no more than one screenful of code, and quite often less. Exceptions to this are [[http://catb.org/jargon/html/H/heisenbug.html | Heisenbugs]] (memory corruptions and threading errors), which are notoriously difficult to reproduce outside their natural habitat. The process of reducing the size of code necessary to reproduce the problem should result in you finding the problem yourself ~80% of the time -- it is a highly educational process. Programming errors can usually be reproduced in no more than one screenful of code, and quite often less. Exceptions to this are [[http://catb.org/jargon/html/H/heisenbug.html | Heisenbugs]] (memory corruptions and threading errors), which are notoriously difficult to reproduce outside their natural habitat.
software/machetedebugging.1604596323.txt.gz ยท Last modified: 2020/11/05 18:12 by solar