CSC 216/s08/cultivate virtue
Formatting Resources
Formatting Help Guide from MetaWiki
Alphabet Soup
Object Oriented Instruction
Many students enter csc 216 with very little idea of what it is for a programming language to be 'object oriented.' Our goal is to help students understand the benefits of a system that allows for black box architecture in a closed source environment.
Required Resources
For this exercise participating students will want to be close to a white board and have access to a working dry erase marker. No other resources are needed.
The Exercise ... dum dum dum
The idea here is to create a working human powered version of a sentence writing class. Obviously such a thing is not actually useful or even logical in a Java environment but we feel that it's a great way of explaining the power of object oriented programming.
First, the architecture. -At the lowest level are the letters. Students will be given a group of letters that fall within their jurisdiction. For example, the vowel class student would have a,e,i,o, and u under their control. As many or as few letters as desired can get given to any individual student. Punctuation marks can also be included here if desired. The job of each student of the letter class category is simple. When called (which is as simple as a higher class saying "I need an 'a' or I need a capitol 'a'") the student writes the required letter/punctuation mark at the next available place on the board. The student in charge of spaces should make some identifying mark, such as an underscore to designate a space.
-At the level above the letters are the word classes. There are nine of these (noun, verb, adjective, adverb, preposition, conjunction, and interjection). One of these should be given to each of nine students. The job of these classes is a little more interesting than that of their letter brethren. When called, it is their job to come up with a word that fits their category; so for example, when noun is called (again, by someone of a higher class saying "I need a noun") the noun class person might come up with the noun ball, or tree, or anything they so desire, much in the spirit of ad libs. Having come up with a word, the class then makes calls to the letter classes in order to 'print' the desired word to the board.
-We will have one class that acts as manager. This is the class that makes calls to noun and verb and etc. It is also this classes responsibility to make a call to 'space' between words. The creativity of this class can allow the exercise to be entertaining and fun.
Thoughts
This exercise doesn't encompass sections of Java that are necessarily hard to understand. Instead it strives to help students get into an object oriented mindset. The ability to program cannot truly be taught. Instead we can only help students to try and understand how an object oriented language like Java works. Once students begin to grasp the power inherent to a language like Java.