Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Lesson 2 (ControlFlow & Collections)

Sally Steuterman edited this page Jul 28, 2020 · 1 revision

Lesson 2: Control Flow and Collections

In the prep work this week, the students learned

  1. The C# syntax for conditionals and loops:
    1. if, else, if/else
    2. switch statements
    3. for, while, and do...while
    4. break and continue statements
  2. How and when to use list, array, and dictionary collections.

Announcements

  1. Remind students that Graded Assignment #1 is due soon! They should be able to complete it after today's class.
  2. Check with your class Candidate Engagement Manager for any other announcements.

Large Group Time (Instructor)

Lesson 2 Topics That Require Careful Attention

  1. 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 C# is just a matter of recognizing the different syntax.
    1. Ask the class to give some examples of similarities or differences for conditionals and loops in C# vs. other coding languages.
  2. 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 use if/else statements much more often than switch.
  3. Ask the students to explain the difference between while and do...while loops.
  4. Review how to use break and continue statements within loops.
  5. Review foreach loops in the context of array and list collections. Note how the syntax changes when applied to dictionaries.
  6. As much as possible, live-code examples for lists and dictionaries, including how to use the most common methods.

Lesson 2 Studio (TA Notes)

  1. With your group, discuss the "Some Items to Ponder Before Starting" section of the studio instructions.
  2. Remember to check in with EVERY student during the studio time.
    1. Ask them detailed questions about studio 1 if they did not finish it before the end of the last class.
    2. As they code studio 2, ask them to explain what different portions of their code does.
  3. Common mistakes:
    1. Not properly setting up the Main method.
    2. Forgetting to import the necessary classes (e.g. List).
    3. Even though dictionaries are the better option, many students will try to use arrays or lists because they see them as being easier. While the students could make these collections work, be prepared to talk about the differences between the different types of collections and why dictionaries would be the better option.
  4. Be sure to do a visual check of your students' code.
  5. 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?").
  6. Remind your students to push their work up to GitHub when they finish the studio.