Monday, August 26, 2019

Updating and Expanding Programming Projects

I’m always looking for new projects. I found an interesting example in the book “The Creativity Code” (Creativity Code review here). It was a poem generator that took random adjectives, adverbs, verbs, and nouns and fit them in “missing” spots in a template. It looked like fun but as I thought about it, it was really just a different version of a MadLibs type of game. It’s also similar in some ways to the Shakespearian insult project (have you seen the Shakespeare Insult Kit at MIT?)

What I would like to do is expand a project. That is to say I would like to take an existing project, like the Shakespeare Insult project and add something to it. Projects that grow and build as new knowledge is learned can be highly motivating.They mean students don’t have to start a project from scratch. This also reinforces the idea that programs can, and often are, modified and enhanced.

Currently my Shakespeare project teaches about parallel arrays. What I have been playing with is adding a class to this project later. An object of this class would store  array lists of strings and have a method to return a random string when asked. Retro fitting the new class should be fairly easy for most students. They will see how this simplifies code

insults.Next()

being easier than

insults[r.Next(0, 50), 0]

While simple at first I have realized that there are multiple constructors that should be created for this new class. An empty list and an object initialized with an array (or other list) at a minimum. Similarly there should be an Add method which would have several overlays – individual strings and an array of strings are two obvious examples. I am sure that student will think of others as we go along.

I’m optimistic that this idea will lead to some useful discussions about thinking ahead about how a class might be used and how it could be written to be useful in a number of different design cases. At the very least I had fun reviewing ArrayList as I wrote some code as a thought exercise.

No comments:

Post a Comment