Visual Exception Handling Excercise: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Place Title of Exercise Here==
==The Throw Down==


Give the title of your exercise, which may include the name of the topic you are covering, or some other catchy title.


===The problem===


Describe what you are attempting to teach students by this exercise.
===The Problem===


===Participants and props===
Students learn about how thrown exceptions are caught and handled. Exceptions are represented in a real-life set diagram constructed of trays and buckets. Students are given "exceptions" to "handle" by tossing them into the appropriate buckets.


How many students will participate?  What else do you need (e.g., old tennis ball, Powerpoint slides, software).
===Participants and Props===


===The script===
One class member will participate in the activity at a time. The activity can be performed with a variety of sizes of trays and buckets with large labels. One suggested combination is one large tray, two large buckets, and one small bucket. In this scenario, both large buckets (labeled 'IOException' and 'ClassCastException') sit inside the tray ('Exception'), and one small bucket ('FileNotFoundException') sits inside one of the large buckets ('IOException'). This symbolizes the relationship that IOException and ClassCastException extend Exception, while FileNotFoundException extends IOException. The activity will also require a tennis ball and several cards with code written on them.


Describe how to do your exercise.
===Instructions===
 
Students will come up one at a time and each be given a card. The card will contain code which will somehow fail, throwing an exception. The student will then receive the tennis ball.  The student will decide which exception the code throws and attempt to 'throw' the tennis ball into the appropriate bucket/bin.  If they make the bucket and it is the right exception, they will be awarded one point.  The student with the most points at the end of the game wins.
 
===Acknowledgments===
 
This exercise was created by Jason Cockrell and John Phillips

Latest revision as of 01:58, 18 November 2009

The Throw Down

The Problem

Students learn about how thrown exceptions are caught and handled. Exceptions are represented in a real-life set diagram constructed of trays and buckets. Students are given "exceptions" to "handle" by tossing them into the appropriate buckets.

Participants and Props

One class member will participate in the activity at a time. The activity can be performed with a variety of sizes of trays and buckets with large labels. One suggested combination is one large tray, two large buckets, and one small bucket. In this scenario, both large buckets (labeled 'IOException' and 'ClassCastException') sit inside the tray ('Exception'), and one small bucket ('FileNotFoundException') sits inside one of the large buckets ('IOException'). This symbolizes the relationship that IOException and ClassCastException extend Exception, while FileNotFoundException extends IOException. The activity will also require a tennis ball and several cards with code written on them.

Instructions

Students will come up one at a time and each be given a card. The card will contain code which will somehow fail, throwing an exception. The student will then receive the tennis ball. The student will decide which exception the code throws and attempt to 'throw' the tennis ball into the appropriate bucket/bin. If they make the bucket and it is the right exception, they will be awarded one point. The student with the most points at the end of the game wins.

Acknowledgments

This exercise was created by Jason Cockrell and John Phillips