Computer Science Teacher
Computer Science Teacher - Thoughts and Information from Alfred Thompson

January, 2007

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Attention Canadian Secondary School Programming Students

    • 0 Comments

    There is an online community site for Canadian students and programming enthusiasts at Compsci.ca. They have discussion forums (discussing languages including C, C++, Java, PHP, Ruby, Turing, and Visual Basic), a wiki and a blog.

    That site is also involved with the DWITE Online Computer Programming Contest which is open to Canadian Secondary School Students.

    If you are a student, a teacher or a computer enthusiast in Canada you may want to check it out. I'd welcome reviews by others in the comments. What do you think of this site? Are there others like it that I should know about?

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Thinking About Numbers - Decimal, Binary and Roman

    • 3 Comments

    One of the things I found to be a little bit scary was how limited the understanding so many high school students had about the nature of numbers. Oh sure they understood the difference between real number and integers and they had a sense of the scale of numbers (what's large? What's small?) but they seemed somewhat uninformed or perhaps lacked understanding of how numbers were formed. let me spell that out. When explaining binary numbers ("This is the ones digit, this is the twos digit, this is the fours digit") it seemed like some students had trouble relating that to the ones, tens and hundreds digit they were used to in decimal. Back in the middle ages when I was a student we learned about different number systems long before I got to high school. It really improved my understanding of how numbers worked.

    I remember learning bases 5, 7 add 8 for example. I used to just play with different number bases for the fun of it. Later when I was a computer science student in college base 2 (binary), base 8 (octal) and base 16 (hexadecimal) seemed quite natural to me. Learning the tricks for converting between octal and hexadecimal and binary made it reasonable to think in those number systems. I generally didn't waste time converting back to decimal unless there was a specific need to display numbers for "regular people." I don't see much of that any more. I wonder how many students learn number bases other than ten at all unless they take a computer science course.

    Displaying numbers for different applications is where understanding how numbers work really comes into play. There are two projects that I have used to reinforce that sort of thinking. Displaying numbers as text and displaying Roman numbers.

    Generally students when presented with the task of converting integers to Roman numerals first think of using If statements. One If statement for each number. This works just fine (more or less) when the range of numbers runs from one to ten. It works much less well for ranges that go into the thousands. I used to require handling any number up to 4999 because numbers above that require horizontal lines about some characters and that would require students to find a way to draw that. Perhaps that would be a nice challenge for some but outside the scope of what I was trying to teach at that point of the semester.

     The big thing I found binary really useful as an OS developer was bit flags. There were lots of activities and status events that could be tracked using binary values - on or off. Back in the day when I was doing this memory was counted in kilobytes not megabytes or gigabites. Using one wrod to keep track of a lot of flags was necessary. For performace reasons you'd even want those values in a register making good use of space even more important.

    This is where being able to know what a bit set or bit test operation is all about. This is when knowing that writing a five to a location sets two bits and resets the others and which bits those are. Does every programmer use that sort of knowledge on a regular basis? Probably not. But when you do need that knowledge it is going to be important and you will need to know it well.

    One more important thing about understanding numbers is realizing that fractional parts of real numbers are stored as binary and what that means. The most important thing it means is that some numbers that we take for granted in decimal are very different when converted to decimal. For example that .1 is a repeating fraction when converted to binary. The old favorite of having a program make change is great for teaching that lesson the hard way. All too often it seems that lesson takes a  while to sink in though. I have on occasion gone through the exercise of converting decimal fractions into binary but I think I would prefer if some middle school math teacher had done it first so I wouldn't have to.

    Lastly I think the most important thing I learned from learning number bases early was that numbers can be fun. In middle school a lot of things can be taught as fun and interesting without trying to impress on students importance that they are not yet ready for. I learned that playing around with numbers could be fun and was very pleased when I later learned that such things were useful as well. While older students tend to demand that education be relevant and useful younger students care at least as much about things being fun. Teaching math (and numbers) as fun while students are young seems like it would be a good thing. It requires teachers who know their stuff very well and enjoy the subject though. That latter part seems to be harder to find all the time though. I have not easy answer for that one.

     

    Technorati tags: , , ,
Page 9 of 9 (26 items) «56789