We’re covering Classes and Objects in my Programming Honors course this week. Specifically we are learning how to program classes in C# and use them in programs. The struggle for me is to come up with classes that are interesting to students, practical for them to use, and not overly complicated. This is not Advanced Placement computer science A and we don’t have a whole year for the course.
I start with a simple Dice class. Easy enough as an introduction . I also live coded a Coin class. The difference being that I added images to the coin class to show them that more interesting objects can be used in classes. So what next?
Things I have used in the past include a playing card class. Interestingly enough this has had cultural implications. I have international students who are not always as familiar with American playing cards. But it works. There are a lot of pieces to playing cards and you can do them simply (face value and suit) or complicated (Face value, suit, nominal value – face cards are 10, front and back images, suit color, text names, etc) Methods and constructors can get interesting to say the least. So can creating programs to use the “cards.”
I tried a Pez dispenser class once. I do have a 12 inch Pez dispenser on my desk after all. I’ve done it the simple way with just a capacity value and a current count value. What I would really like to do is use a stack in the Pez dispenser class and have candy objects to put in it. If I were teaching APCS A and had time to cover stacks I would do this for sure. But I don’t.
I’ve thought about revisiting some of the class projects from prior AP courses. Anyone remember BigInt? I kind of liked that one. I did more with the Marine Biology Case Student but my students never really liked it. They called it the DAF – Dumb Ass Fish case study. Both may be a bit much for the time I have though.
I had some fun with a quiz question class last year. Data included the question, an array of possible answers, and an index of the correct answer. I liked that for showing how flexible array parameters could be. A true/false question is just a question with two possible answers. The next design question is of course do you have a simple array of questions or do you design a quiz class? If a quiz class, what does that even look like? Might be fun the have students try that design.
I’m still playing with more ideas. I’ll have to use something tomorrow but maybe the good idea fairy will hit before Monday. Suggestions anyone?
1 comment:
class Robot... Declare some instance variables (every instance of a Robot has a name, an owner, an id, etc.) and a few instance methods (turnOn(), spin(#degrees), move(x,y), etc.)
Post a Comment