GithubHelp home page GithubHelp logo

leio10 / practical-debugging Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kddnewton/practical-debugging

0.0 2.0 0.0 39 KB

Code for the "Practical debugging" talk

Home Page: https://speakerdeck.com/kddeisz/practical-debugging

Ruby 100.00%

practical-debugging's Introduction

Practical debugging

Identify the type of problem you're facing by determining which question you're asking. Follow the techniques below.

Interface problems

Interface problems occur when you don’t understand the dependent structure of methods or constants.

Questions like:

  • Why is this thing nil?
  • Why can’t I call the method I want?
  • What are the constants I can reference?
  • What can this object see and do?
  • What is this gem doing?

Questions to ask yourself:

  • Did I handle every type of object that can be returned from this method (including nil)?
  • What is the value of self in this block?
  • Did I account for lexical scope?

Tools and methods to use:

Command line utilities to use:

State problems

State problems occur when the assumptions you made about the current state of the program are incorrect.

Questions like:

  • How does this value change at this point?
  • What has been initialized at this point?
  • How many objects are allocated in this method?

Questions to ask yourself:

  • What am I assuming about the current state of the program at this point in code?

Tools and methods to use:

Flow problems

Flow problems occur when you don’t know how the ruby interpreter got to or left a location in code and its associated state.

Questions like:

  • How did the interpreter get here?
  • Where does the interpreter go from here?
  • How did this object get here?
  • Where is this object being mutated?
  • When does this instance variable get set?

Questions to ask yourself:

  • What am I assuming has happened or is going to happen next?

Tools and methods to use:

References

Code examples

For minesweeper, run bundle install in the root of the repository to fetch the dependencies. Then run bin/minesweeper to run the program. The number of rows, columns, and mines can be specified as command line arguments in that order.

practical-debugging's People

Contributors

kddnewton avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.