-
Notifications
You must be signed in to change notification settings - Fork 59
Lesson 2 (ControlFlow & Collections)
Courtney Frey edited this page Apr 15, 2022
·
3 revisions
- The Java syntax for conditionals and loops:
- if/, else, if/else
- switch statements
- for, while, and do...while
- How to use the Array, ArrayList, and HashMap collections.
- Check with your class Candidate Engagement Manager for any other announcements.
- Remind students that Graded Assignment #1 is due soon! They should be able to complete the project after today's class.
- Welcome to Day 2!
- Lesson 2
- Leave time in afternoon to introduce Assignment 1
- Graded Assignment #1 is open! With each of the graded assignments in this unit, the key is to read through everything carefully and start on what you can do as soon as possible. In class, read through the instructions with your students and highlight what they are capable of doing after this class.
- Assignment 1 work day scheduled for Days, 4, 6 & 7
- Encouragement: Point out that learning a second coding language is usually easier than learning the first. The students already know how to use loops and conditionals, so applying them in Java is just a matter of recognizing the different syntax.
- Ask the class to give some examples of similarities or differences for conditionals and loops in Java vs. other coding languages.
- The "fallthrough" aspect of
switch
statements is not always obvious and should be reviewed. However, do not sink too much time into this, since the students will useif/else
statements much more often thanswitch
. - Ask the students to explain the difference between
while
anddo...while
loops. - Review how to use
break
andcontinue
statements within loops. - Review
for...each
loops in the context of Array and ArrayList collections. Note how the syntax changes when applied to HashMaps. - As much as possible, live-code examples for ArrayLists and HashMaps, including how to use the most common methods.
- With your group, discuss the "Some Items to Ponder Before Starting" section of the studio instructions.
- Remember to check in with EVERY student during the studio time.
- Ask them detailed questions about studio 1 if they did not finish it before the end of the last class.
- As they code studio 2, ask them to explain what different portions of their code does.
- Common mistakes:
- Not properly setting up the
main
method. - Forgetting to import the necessary classes (e.g. HashMap).
- Even though HashMaps are the better option, many students will try to use Arrays or ArrayLists because they see them as being easier. While the students could make these collections work, be prepared to nudge them in a different direction if they get stuck.
- Not properly setting up the
- Be sure to do a visual check of your students' code.
- For the students who finish early, ask guided questions to encourage them to try one or more of the bonus tasks (e.g. "How could you modify your code to count 'a' and 'A' as the same letter?").
- Remind your students to push their work up to GitHub when they finish the studio.