Guide to Office Hours

Welcome to CS 15. Here are some tips for office hours to ensure the time is spent productively.

What to do before coming to office hours

The course staff expects you to have utilized these resources and followed these steps before coming to office hours and we reserve the right to direct you to these resources before helping you in a one-on-one session. If you have questions about how to use these resources or want to clarify expectations for office hours, post on Piazza or come to OH in the first week!

Read all links on the course calendar, especially the Self-Study modules on File I/O, Valgrind, and the STL vector class, search keywords on the FAQ page, and follow the debugging procedure outlined below.

The Debugging Procedure

As you deal with data structures of increasing complexity, it is likely that you will encounter bugs that are difficult to find in hundreds of lines of code. TAs are not magical figures: we often do not know any better than you do where potential issues lie without print statements.

  1. Include relevant print statements: at the beginning and at the end of functions, before and after function calls in main() or in another function, before/during/after loops, and at several levels of recursion. We will likely hold a tutorial in the first week of class (to be recorded as well) of how to use print statements effectively.
  2. Valgrind is a great tool that is explained in the Valgrind handout (read it!) but here are some general tips:
    • Do not assume that your segmentation fault is only related to the line Valgrind gives you: the issue often lies in another part of your code that affects the line given by Valgrind -- this is why print statements are critical.
    • If you are debugging memory errors, start at the beginning of the error messages and work downward. Again, print statements are your friend as long as you are not trying to print the values of a null pointer or values that have been deleted, which will cause a segmentation fault.

The expectations for office hours

We recognize that CS 15 is challenging, which is why we offer a robust office hours schedule! With that said, we'd like to make some expectations clear.

  1. Please come to office hours with a specific question and the debugging procedure completed. We are unable to help students who have extremely broad issues, such as My entire code doesn't work.
  2. While we do not enforce strict time limits with students, we must also keep the flow of the queue moving, so we will provide suggestions to your question and answer syntactical questions, but will not observe your implementation of our advice.
  3. We do not take requests for specific TAs unless one individual has already been helping you in the same session and your question is a specific follow-up. All of our TAs are qualified to answer questions.
  4. Expect office hours to be very busy right before the deadline with potentially long wait times and limited TA interaction. Come earlier in the week if you are interested in a longer discussion on design, pros and cons of different approaches, runtime, etc.
  5. While we absolutely encourage you to post on Piazza with questions (privately if code is shared!), it is difficult to provide meaningful advice on a major bug or segmentation fault based off of a small snippet of code or a single screenshot. In cases like these, we encourage you to come to office hours to have a live discussion.

With all of that said, office hours are an amazing resource and we absolutely encourage you to take advantage of them!