Monday, July 19, 2010

The logic of computer programming courses

An article in last week's Education Week reports that schools are falling behind in their computer science offerings at the same time that the demand for programmers has risen. Computer science advocates are now calling for more computer science offerings in public schools.

In the process, some are trying to clear up a major confusion that has many schools offering courses on Microsoft Windows, Power Point, and Adobe Photoshop instead of actual programming courses:
Proponents of computer-science education say a major hurdle is simply getting school officials and others to understand what the field is, and isn't.
"One of the biggest problems is schools confusing computer literacy with computer science," said Barbara J. Ericson, the director for computing outreach and a research scientist at the Georgia Institute of Technology, in Atlanta.
"A lot of places don't understand the difference," agreed Ms. Cuny of the NSF, which is providing grants to support a variety of programs and research undertakings on computer-science education. "They're not teaching kids how to be creators of technology—they're teaching them how to be users of technology."
Sounds a bit like the confusion between teaching science and teaching science appreciation, and it's nice to see that the computer science advocates, unlike many of the science advocates, understand the difference.

Some computer programming advocates are concerned that even when schools do teach programming, they leave out many of the more challenging concepts that the pioneering programmers of tomorrow need to master.   As GoogleMaster recently commented on JoanneJacobs:
Learning to *use* computers is easy. Learning to *design* computer hardware or to write software that handles edge cases properly and not just the “happy path” is difficult. Millennials think they’re smarter than the boomers and the boomers’ parents merely because they can use the technology. They forget that the boomers and the generations before them invented the technology that the millennials are using.

- Internet (ARPAnet): 1960s, created by a team at MIT who were born late in the Silent Generation.
- First email message: 1969, sent by a Boomer.
- First cell phone: 1973, invented by Martin Cooper, Silent Generation.
- World Wide Web, first HTTP communication, 1990, Tim Berners-Lee, a Boomer.

As for music recording and playback: the pulse-code modulation that makes it possible was patented in 1937 by a member of the Greatest Generation. The first digital speech transmission was in 1943; computerized digital recording was invented in 1957.

If we don’t provide the STEM grounding necessary to understand the technology already in existence (how and why it works, not how to use it), I don’t see how future generations will be able to invent anything of substance.
The popular programming language now is Java, and for many hard core programmers this language is simply too easy. For example, Joel Spolsky laments on his software blog that the introductory programming course at the University of Pennsylvania now uses Java instead of Scheme and ML. Unlike Java, Scheme and ML involve hard concepts like pointers and functional programming (including recursion).  These concepts, Spolsky writes, are "still important for some of the most exciting programming jobs":
Without pointers, for example, you'd never be able to work on the Linux kernel. You can't understand a line of code in Linux, or, indeed, any operating system, without really understanding pointers.

Without understanding functional programming, you can't invent MapReduce, the algorithm that makes Google so massively scalable. 
Beyond these specific benefits:
Pointers and recursion require a certain ability to reason, to think in abstractions, and, most importantly, to view a problem at several levels of abstraction simultaneously. And thus, the ability to understand pointers and recursion is directly correlated with the ability to be a great programmer.
In a comment on the last blog post I wrote addressing these concerns, Seth, who helped to teach Penn's introductory programming course, concurs with Spolsky:
What he says about pointers and recursion enforcing and testing a certain way of thinking is a very important point, in my opinion.

But what I found really disturbing from helping to teach that course was that it was possible, indeed universal, that the students who came from the best high schools and had the most experience had never been exposed (consciously) to problems of recursion. Why is it that e.g. the Towers of Hanoi problem has to wait until college to be taught? Students need to be hit with this when they're younger, before their brains start to rot.

I really wish that when people talk about the need for computer in schools, the focus would be not just on computers, but computers as a way to teach how to think about breaking up a problem. But I'm an old-fashioned fart, so I still think that one of the best preparations for programming is geometry, and the process of proving a theorem. I'm scared to ask if that is still taught in high schools.
As our problems of the week here have shown, Seth has good reason to be scared.  In connecting geometry proofs with computer programming, he raises an important point: is the American education establishment, with all its calls to teach "higher level thinking skills," no longer interested in logical reasoning?

Actually, anyone who has tried to reason logically with some of these education leaders already knows the answer to that one.


Niels Henrik Abel said...

is the American education establishment, with all its calls to teach "higher level thinking skills," no longer interested in logical reasoning?

Actually, anyone who has tried to reason logically with some of these education leaders already knows the answer to that one.

As does anyone who does after-school tutoring. Working in this field since the early part of this decade, I've witnessed firsthand the schools' poor track record in this and other areas. For all the schools' talk about "critical thinking," "creative problem-solving," etc., today's students are unable to critically think their way out of a paper bag. You see this not only in math, but in subjects like English - so many of them get hung up on the verbal portion of the SAT because they are unable to make inferences based on the reading passages. They get stumped on just about any type of question that's deeper than factual questions like the 5 w's (and I'm not too confident in their ability to handle the "why," either).

Don't even get me started on the average student's ability to handle "story problems."

gasstationwithoutpumps said...

The high school my son is starting at next year has no computer science. The "computer" classes they have are web-page design and computer animation (neither involving programming, just use of WYSIWYG tools).

Luckily my son has had a fair amount of computer programming at home (science fair projects in scratch and in C) and in middle school (a high-school level course using Dr. Scheme, with lots of recursion and explicit state). He is now learning Python at home.

The stuff he has learned so far includes iteration, multi-threading (from Scratch), arrays, pointers (from C), recursion (C and Dr. Scheme), unit testing (Dr. Scheme), object orientation (Python), and polymorphism (Python). In each case, he learned the concepts in a language that was well suited to that particular concept, which made the learning easier.

Java will come in a year or two, along with C++---I regard them as decent languages, after the basics have been mastered in simpler languages. My workhorse languages for my own work are C++ and Python.

I'm thinking that there needs to be some programming at the high school, and am thinking of volunteering to create a First Lego Robotics team, or a Scratch class, or something to catch the interests of the kids.

Obi-Wandreas, The Funky Viking said...

When I was a kid in the early 80s, I subscribed to PBS's "The Electric Company" magazine. In the magazine would often be a computer game of one form or another.

But not on a disk - oh, good heavens no! On a sidebar they would have a description of the game, and then the source code in BASIC. You type it into your Apple ][ and boom! - there's your game. They never explained the code, but it was so simple that, as you typed, you could pretty much figure out what each line was telling the computer to do.

If I had a link to download each program, I would never have given it a second thought. But when you do it yourself? - that gets a kid interested.