CSC 216 F09/Interface

From Expertiza_Wiki
Revision as of 03:54, 24 November 2009 by Amchu (talk | contribs) (→‎Interfaces)
Jump to navigation Jump to search

Interfaces

The Problem


This exercise is designed to grab the students' attention through a variation of Pictionary, and then teach them the basics behind the structure of an interface. By the end, they should be able to recognize when it is appropriate to organize and implement an interface for similar classes containing similar methods.

Participants and Props


  • 3 volunteers
  • Sets of 3 object cards
  • 3 markers
  • Whiteboard

The Script


1) Before the exercise begins, the instructor should have prepared multiple sets of 3 index cards. In every individual set, the index cards should have a single, drawable object written on it. All three of the objects in the set should be able to have a single adjective ending with the suffix "-able" used to describe. The instructor can use the suggested sets listed below, or come up with his or her own.

2) If the index cards are prepared, three students will either volunteer or be called upon to go to the whiteboard. Once there, they will each be given an index card from the set, whereupon they shall draw the object written on their card.

3) When they are all done, the other students in the class should be prompted to guess what each of the pictures is supposed to be. These objects will represent java classes.

4) After they finish guessing, they should be asked to find a specific adjective which ends with the suffix "-able" that applies to all three of the objects. This will represent the name of an interface.

5) When they have found the word the instructor is looking for, they should then be asked to give any number of possible methods that apply to the interface and all three of the objects.

6) Repeat steps 2 through 5 until the class understands the concept or there are no more cards remaining.

Index Card Suggestions


Flyable:

  • Plane
  • Blimp
  • Predator (Unmanned Aerial Vehicle)

Possible Methods

  • Take-off
  • Land
  • Steer


Storeable:

  • Treasure Chest
  • Dumpster
  • Hard drive

Possible Methods

  • Lock/Unlock
  • Add
  • Remove


Kickable:

  • Soccer ball
  • Bucket
  • Foot ball

Possible Methods

  • Apply force
  • Retrieve