Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 2.6 KB

File metadata and controls

48 lines (34 loc) · 2.6 KB

Exceptions in C#

The activity aims to present an overview of types of exceptions in C#. Participants will work in small groups to get familiar with commonly used exceptions, and model situations when to throw or catch the particular exception. It also aids in developing of good programming habits.

Parameters:
Duration: 30 minutes
Participants: 4–20 students
Instructors: 1 teacher
Class: table/board
Resources: printed cards for each group
Prerequisites: OOP basics, what is the exception

Learning outcomes

  • Student will gain an overview of common exceptions in C#.
  • Motivates good programming habits.

Setup and preparation

  • Print and cut the cards (English, Czech).
    • Use one-sided printing.
    • Print one set for each group.
  • Prepare the solution for projector (English, Czech).
  • Print the printable solution as a backup (English, Czech).

Activity overview

  • Give a stack of cards to every group. The stack contains the red (exception), yellow (description), green (throw), and blue (catch) cards.
  • Students should proceed through the stack in order (red, yellow, green, blue). The cards form groups where there is one card of each color. Emphasize that.
  • Teacher guides the students toward the goal and answers the questions.
  • Once all groups have correct groups, or after maximum 10 minutes, groups receive the purple stack.
  • There can be more than one card from purple stack attached to a group. There can also be groups without the purple card.
  • Once all groups have correct groups, or after maximum 5 minutes, there is a wrap-up of the activity. The teacher goes column by column and presents arguments for each matching.

Tips and tricks

  • Activity should come right after the introduction of exceptions in C# course.
  • In case of larger discussion, the teacher should cut it and refer to the related material.

Related material

Author

Lukáš Daubner, 2018