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

September, 2008

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Alfred VS Clint: C# versus VB debate


    Clint Rutkas (who is better than everyone) Twittered his distaste for Visual Basic and preference for C# today. Now C# is a great language and I really do think that the features they borrowed from Visual Basic (properties for example) make it the best of the C family of languages. Visual Basic also had edit and continue for years and years before C# developers were able to convince the Visual Studio that they wanted it too. But to me C# not as clean as Visual Basic. So of course I responded right away. This lead to an Instant Message conversation and discussion of a nerd off. So here now is my defense of Visual Basic. Clint’s opening statements are on his blog here.

    I have never been a fan of C style languages. To me the use of the semi-colon and curly braces are crutches for the compiler writers and hindrances for programmers. If we were going to go that way we could have stayed with APL – a very powerful language but confusing for programmers. And they are ugly and confusing too!

    The required semi colon is particularly a problem. How many times have programmers, especially but not exclusively beginners, terminated a loop accidentally by placing an extra, and hard to see, semi-colon at the end of a line? And a missing or misplaced closing brace is a lot harder to find than a missing End If. Contrary to Clint’s claims I maintain that the code samples he shows prove that VB is easier to read.

    And then these is white space. In Visual Basic white space means something and enforces some organization of statements. You don’t see contests to see who can write the least understandable Visual Basic code as you do for C (and could do in C#). Just because it was hard to write doesn’t mean it should be hard to understand.

    Oh and did I mention the My classes? Not strictly a language feature but they do make it very easy to do some powerful tasks in Visual Basic programs.

    Note: See also Line Continuation and Visual Basic – More on C# vs. Visual Basic and Visual Basic .NET and C# Side By Side

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Binary Number Game


    I love binary numbers. I was first taught about different number systems in grade school and was fascinated with them immediately. I used to convert decimal numbers into different base numbers just for the fun of it.  So I guess it is not surprising that I love computer projects that involve binary, hex, and octal numbers.

    I recently found this binary teaching game on a Cisco web site. The music is annoying but that could be my age. If you use it you may want to make sure the students turn off the music or your lab will be really noisy.

    But while playing games is fun I’m a “let me make my own game” sort of guy. So when I saw this program my first thought was how can I make that into a project. So while sitting through a conference call I started playing. I came up with the following (in Visual Basic .NET FWIW but I’m not sure language choice is a big deal here.):


    The way it works is that by clicking on a button one toggles the zero and one values and changes the decimal value that is displayed. It’s a pretty simple program. One could add some complexity by allowing a user to enter a decimal value and have the buttons change to represent the binary equivalent. One could also modify this to handle other number bases. One could either have multiple clicks of a button increment (and wrap) the value displayed or one could use text boxes to allow a user to enter a value. There are pros and cons to either option.

    The button option forces students to understand the counting in different number bases which is valuable. The text box option forces a student to do data validation and error checking. That’s a whole different but potentially more valuable lesson. It all depends on the goal of the project.

    What do you think? Will these ideas work in the classroom? How would you change them?

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Programming in Applications


    First a true confession – regular expressions are a pain for me. Oh don’t get me wrong, I think they are wonderful things in their place. I took a couple of compiler related courses and I studied them seriously. But somehow I still struggle with them. I am apparently not alone in this. I heard a talk once where the speaker (not sure who they were quoting) said “Say you have a problem, and say you decide to use regular expressions to solve it, now you have two problems.” Everyone laughed. Though since this was a serious computer science audience I’m sure a couple of people were thinking “I don’t have a problem with regular expressions” but were too polite to say anything out loud.

    I do however love to parse strings. No, really I do. Does that make me weird? Probably not as much as other things but let’s not get into that. Not all programming languages support regular expressions and many software tools that allow some level of programming also don’t support regular expressions. That gives me an excuse to avoid regular expressions from time to time. Recently Clint Rutkas, a very bright guy who probably has no trouble with regular expressions, was asked for help parsing strings using Excel. He blogged about it here.

    Did you know that there were string parsing and manipulation functions in Excel? I’m sure I’ve seen them in function lists but honestly I never paid much attention before. We don’t often think of spreadsheets as programming platforms but clearly they are. There are functions and expressions to build. There are decision structures like IF and VLookup (one of my favorites). There is even conditional formatting which I really like to use to highlight activities. And the list goes on and on. That’s not even including Visual Basic for Applications which lets people create and use their own functions. How many of us really use all this functionality? Not many of us.

    And that is something I see as a problem. We have this powerful tool available for people of all backgrounds and jobs and interests and yet most people only use a fraction of the power that is there. Suppose more people understood how to program though? Suppose that thinking computationally was a natural and developed part of their processes? Suppose people were more aware of the possibilities? What would they do? Computer spreadsheets have already allowed people to do a lot that was never practical before. If more people could use the programming capabilities to even a little bit higher of a degree spreadsheets would become even more powerful and more useful.

Page 1 of 8 (22 items) 12345»