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

March, 2011

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Object Oriented Programming is Dead



    OK perhaps not dead but Robert Harper, a professor at Carnegie Mellon University, says(Teaching FP to freshmen) that object oriented programming and design is “unsuitable for a modern CS curriculum.” More of the quote in context is:

    "Object-oriented programming is eliminated entirely from the introductory curriculum, because it is both anti-modular and anti-parallel by its very nature, and hence unsuitable for a modern CS curriculum."

    As you might imagine there is some dissent in the comments. When I posted this link to my Facebook page there were some 16 comments, mostly in disagreement, in a short period of time. One person, who hires people for industry responded with “I'm tired of interviewing interns who know Haskell but can't code up strlen() in C. ” But as Robert Harper says in a reply to a comment on his post “Our goal at Carnegie is provide students with an education, not training.” What does that mean anyway? Is there a conflict between industry and academia? Academics often believe that “There are plenty of opportunities for them to learn the old ways, and to pick up industry practices on the fly” while industry hiring managers lament the fact, as one VP told me, that it takes an average of a year and a half to turn a recent college hire from a good school into a fully productive software developer. Is is any wonder that many companies prefer not to hire people right out of college?

    I’ve seen programming paradigms come and go. I started programming as industry (and academia) were adopting structured programming. That was a big advance at the time but required some changes in the way people thought and designed code. Later I lived through the long, slow and at times even more painful transition to objected oriented programming. Are we entering the age of functional programming? Perhaps. But perhaps not to the exclusion of other paradigms.

    We do have new needs today. While first structured and later OOP developed to support the needs of larger programs and larger teams of developers as well as the needs of dealing with more data today the key new issue is parallelism. One of the design goals behind the development of F# (a functional language that is built into Visual Studio) is parallelism and making it easier to spread work across multiple processors. Clearly that is where we have to go to continue to be able to take advantage of the newest hardware. But does that mean OOP can become optional or that we can wait for students to learn it after college? That I am not so ready to buy.

    Even at the peak of OOP mania I have maintained that not everything has to be an object and that a mix of paradigms would/did/does work. I think that is still going to be the case even as functional programming grows in usage and popularity. But will old style programming completely go away? I don’t think so.Will objects go away? Not a chance.  I think universities, especially those who provide an “education not training” do their students a disservice if they ignore the reality of what is currently in the field. The handwriting is on the wall and functional programming is going to continue to grow in importance. But ignoring OOP now is not doing anyone any favors. Just my 2 cents.

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    The Credit Card Project


    I’m a firm believer that programming projects are best when they are about things that are interesting to students. Money tends to interest them so I have long thought about a project involving credit cards. Aren’t credit cards what a lot of students think on when thinking about buying things? I’m known that were were codes in credit card numbers for a while. I was pretty sure part of the number identified the type of card and that there was some sort of checksum involved to help do a first cut validation. I just never got around to looking things up (the Bing search) until recently Doug Peterson posted a graphic about credit card validation. There is actually more to validation then what is in the graphic but not much.


    One of the key pieces of this is the checksum algorithm- the LUHN Formula. Basically some digits are doubled and added to the alternate digits which are not doubled. In most cases if the least significant digit of the result is zero the number is valid. Of course valid is not the same as “has available credit” but it’s a good first cut. Doug Peterson wrote a Small Basic routine to validate the checksum. At that link you can try it out and see the source code. Or just try it as embedded below. Doug writes about how his example and my blog post came about at Writing and Sharing Code BTW. And he is right that I should write up a solution myself and it is on my todo list.

    It doesn't do a full card validation though. What else is there?

    • Different companies have different numbers of digits. American Express uses 13 and 16 digit numbers for example
    • Diners Club and American Express cards can both start with a 3 but the next digit depends on which card you are checking.

    Getting it all right requires a little bit of research. I'll leave that to the reader for now. But why else is this a good project in my opinion? Lots of chances to try different decision structures. One can also verify against a user's claims of what sort of card it is or try to calculate the type of card based on the number itself. The project lends itself to a lot of solution options. Lots of options opens the door for lots of discussion about “the best” way to do things. What do you think? Good project? If you try it with students I would love to hear how it goes. Do they find it relevant and interesting? 

    BTW if you are looking for projects try the projects tag to find other posts I have written about various projects.

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    What Is Computer Science All About


    One of the big questions that comes up time and again is “what is computer science all about?” Get a bunch of computer science people in a room and you’ll get almost as many answers as there are computer science people.I don’t have what I think of as a great answer myself. Since I ran into a number of pithy statements on the subject lately I thought I would bring the question to my blog audience.  I was reading a blog post by Rob Miles last week and came across this quote:

    […] try to get a feel for programming and what it is all about. A clue: it is not really mathematics, it is more about organization.

    I do believe that organization is a key piece of computer science in general and hugely important in programming. That is one reason why I believe so many boys take so long to get their code right – they are not used to planning and organization.

    Eugene Wallingford linked to a tweet by Lance Fortnow that also relates.


    Now obviously he should be using Bing to do his Internet searching but that aside he has a good point. Over on Facebook where I put this question Dave Klappholz replies.


    If only there wasn’t as much controversy over what computational thinking is as there is over computer science. Those are all comments by computer science faculty members who teach at the university level BTW. Smart people – real computer scientists. I did a search on Bing for "what is computer science all about" and there were 32 replies – most of which look really useful. Wikipedia says

    Computer science or computing science (abbreviated CS) is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems”

    Reasonable but boring. And not quite a one liner for high school students. Do you discuss what computer science is? What do you tell your students? What do they tell you?

Page 1 of 10 (28 items) 12345»