-
Notifications
You must be signed in to change notification settings - Fork 60
Class 02 (Conditionals & Debugging)
KJ Monahan edited this page May 14, 2024
·
2 revisions
- The boolean data type and boolean expressions
- Logical operators (
>
,<
, etc.) and==
vs.===
- Logical
AND
,OR
, andNOT
-
if / else if / else
statements - Three common error types (syntax, runtime, logic)
- How to use
console.log
to help debug code
- Note the due date for the first graded assignment (should be 2 - 4 weeks away).
- Assignment 1 has been broken into 3 parts. Check Canvas for the due dates for each part.
- The assignment will be active in Canvas soon, and the students will know enough after lesson 2 to begin the first part of the assignment.
- Welcome to Day 2
- Q & A from the prep work and/or exercises.
- Recommend walking through the debugging exercises to reinforce how to spot the different error types, how to use error messages to find bugs, and how to systematically find and fix logic errors.
- Emphasize why
===
should be used instead of==
. - Review the meaning of the truth tables for logical
AND
and logicalOR
. - Clarify with live coding examples:
- The difference between an
if / else if
block and two successiveif
blocks - Nested conditionals
- Check multiple conditions with
&&
and||
- When would we use
!
?
- The difference between an
- Provide an overview of how studio sessions run and how to best take advantage of the time.
- Tasks will be completed in GitHub. Learners will submit a single GitHub URL for everyone in their group.
- Studios provide focused practice in a supervised, safe space. Students are free to explore, make mistakes, and ask for tips.
- Studios are NOT graded, but active participation is essential for success in the class.
- Learners may not be able to finish the entire studio in time. It's more important that they try things out and learn than it is that they check off every requirement -- only the graded assignments are reviewed and graded
- Provide a quick introduction to the Data & Variables studio if the lead instructor did not already do so
- Wrap-up about 10 minutes before the end and share the attendance code and go over again what they need to submit. (The single URL for the group is confusing at first, since elsewhere we stress that everything needs to be their own work.)
- Demonstrate pair programming first
- Help students successfully navigate to the right directory in their repository.
- Encourage best practices for variable names.
- Studios are NOT graded, but for this first task, you should do a visual check of each student's output. The best time to do this is during the studio!
- Common mistake:
- Some students will miss the idea of using variables to create the output. Instead, they will hard code the data values into the
console.log
statements. - Encourage the students to use variables, and explain that doing so allows the output to reflect any changes in the data.
- When the students run their code for you, ask them to change
astronautCount
to a different number (like 3), and then verify that the output reflects the new value.
- Some students will miss the idea of using variables to create the output. Instead, they will hard code the data values into the
- Recognize any clever ideas that the students use to print the tedious parts of the output.
- Even though you do a visual check of the code, students should still "Submit" the GitHub URL in Canvas. That way, they preserve a record of their participation.