Home Schedule Lectures Assignments Participation Resources and Help

Fixing Issues

Are you stuck on something?

We all get stuck sometimes. Here is the sequence of steps you might follow, although the exact things you do obviously will depend on the task:

  1. Help functions and Python documentation
  2. Search Google/Stack Overflow. Stack Overflow in particular is where the programming community asks and answers questions.
  3. Ask your peers - either in person or by posting an issue in the class discussion repo page - and other programmers on Stack Overflow.
  4. The TA’s office hours
  5. My office hours or email. I’ve listed myself last because, although I’m happy to help (I am!), I can’t actually debug for 60+ students.

Asking questions (steps 3-5 above) is an important part of this class! I’m borrowing the 15 minute rule:

Once you’ve spent 15 minutes attempting to troubleshoot a problem, you must ask for help!

How to properly ask for help

This section applies to Stack Overflow, our discussion repo, and if you follow this, office hours will be more efficient too. Coders expect other programmers will try the obvious (documentation, and previous Stack Overflow threads) and then follow these tips so the community can answer effectively and efficiently.

Making your question effective is an art. To make your question effective, the idea is to make things as easy as possible for someone to answer.

You’ll probably find that the act of writing an effective question causes you to answer your own question! So, here are the elements of a good question:

# 1: Introduce the problem with an informative title

Be specific with your title. It should be brief, but also informative so that when others are looking at the Issues page (and they have a similar error and/or solution), they can easily find it.

# 2: Summarize the problem

Introduce the problem you are having. Include what task you are trying to perform, pertinent error messages, and any solutions you’ve already attempted. This helps us narrow down and troubleshoot your problem.

# 3: Include a reproducible example

Including a minimal, complete, and verifiable example of the code you are using greatly helps us resolve your problem. You don’t need to copy all the code from your program into the comment, but include enough code that we can run it successfully until the point at which the error occurs.

# 4: Post your solution

Once you have solved the problem (either by yourself or with the help of an instructor/classmate), post the solution. This let’s us know that you have fixed the issue AND if anyone else encounters a similar error, they can refer to your solution to fix their problem.

# 5: Acknowledgments for this section

A few more tricks to deal with getting stuck

  1. Stop coding! Take a quick break and clear your head.
  2. Get out a piece of paper and map out how to solve the problem using plain words (pseudocode).
  3. Add print statements everywhere (old school).
  4. Use %debug in IPython.
  5. Clear your head more substantive - go for a run, take a nap, get groceries. Returning to the code with a fresh eye will solve problems more often than you would believe.
  6. Sleep! Coding tired is a sure way to make mistakes.




Data Science (broad)

Data visualization

Github, Git, and Version control

Getting data and practicing ML

Some books you might look for