Monday, December 09, 2019

Coding Without a Net

My Programming Honors students are struggling with creating classes in C#. They really wanted me to code up a project live (again) and have them follow along. But I’ve used my usual examples and samples and projects already. First message is that I need more but I had to come up with one for today. And I had writers block. About a half hour before class, with a bit of panic setting in, the other computer teacher suggested a reindeer class. For Santa’s sled. For data use a name, their position on the sled, and if they have a red or black nose. Ok a bit of a goof perhaps but simple and seasonal. Why not?

Now I don’t know about you, but I prefer to write demo code several times before writing it again live in front of an audience. Not an option today but how hard can it be? I’ve written classes many times before and my content knowledge is solid.

I honestly hoped I would make some mistakes. Hopefully the students would catch them. Great learning experience. And yes, I did make a couple of mistakes. I forgot to make the class data private right off the bat. I called for a string parameter in the constructor that should have been an integer. A student caught that one. Winning!

The hardest part for me is that I had only thought through writing the class but now how to test it. I had thought about the constructor (and prepared a data file with 8 normal reindeer and Rudolph) and using ToString (overridden of course) for testing purposes. I had to make up a test for various other properties on the fly. At least that meant students got to see/hear my design thoughts as they happened.

  I’ve also been thinking about a Santa’s sled class that would have an array of reindeer objects. That might be fun if I figure it all out.

Things went pretty well actually. I got a lot of ideas which doing the demo and I’ll be more prepared in the next semester. I need to come up with something seasonal for the spring though. A prom dress class perhaps?So many ideas.

No comments: