Friday, May 22, 2009

Chiming in on the MIT Scheme to Python Switch

So, by now you've no doubt heard - MIT is moving from Scheme to Python for their intro CS courses. I can't help but weigh in on the discussion.

I find the first part of the explanation rather puzzling. According to the post, the old way of writing the software was like so:

In 1980, computer engineering was based on starting with clearly-defined things (primitives or small programs) and using them to build larger things that ended up being clearly-defined. Composition of these fragments was the name of the game.

And the new way of writing software is described as:

However, nowadays, a real engineer is given a big software library, with a 300-page manual that’s full of errors. He’s also given a robot, whose exact behavior is extremely hard to characterize (what happens when a wheel slips?). The engineer must learn to perform scientific experiments to find out how the software and hardware actually work, at least enough to accomplish the job at hand.

Huh? Now perhaps I'm not a real engineer, so my experience doesn't apply. But, how exactly do you write software if you don't start with small working primitives (like unit tested classes, PLT scheme modules, or a PHP library script)? Isn't taking a complex problem and breaking it down into testable/reliable chunks a fundamental principal of writing software?

And yes, nowadays a programmer does typically start with a large API. But I'd hardly say that they are "full of errors." Sure, there may be some issues with the Google Finance API or JDK, but I'd hardly say that the main issue a programmer has is these errors. And besides, thanks to Forum Effect - any issue you have has most likely already been discussed on a forum somewhere, and is just a Google search away.

And yes, it's critical that a programmer learns to run little experiments - but that process is essentially debugging and has certainly been required since the 1980's, if not since the days of ENIAC.

The explanation continues to be a little whacky to me:

The new approach also has the big advantage that it combines computer science with electrical engineering, whereas the old one taught them as entirely separate disciplines. This way, students see how they interrelate.

Again, huh? How is computer science interrelated with electrical engineering? Computer science, to me, is the study of problem solving - not electricity whizzing through CPUs and RAM.

And finally we arrive at the point in the argument that I can appreciate:

There is extensive lab work, making robots and mobile applications.

Aha! By mixing EE and CS, you've put yourself in a position where you can program some hardware - the result is that you're doing something fun, like programming a robot. Instead of doing boring math, you're doing fun robotics.

The Ideal Education

If you ask me (and certainly, nobody in their right mind would), your ideal intro CS eduction should try to balance two competing goals:

  1. Make programming fun/relevant so folks will want to put up with the pain of learning how to do it well.

  2. Teach as many good habits, and as few bad habits in the process

MIT, it seems to me, has solved at least part of the above equation. They're doing fun lab work instead of traditional (read: boring) programming. I'm not sure why they think they need to justify the fun by associating it with EE, when you could easily mix programming with finance, music, biology or any other discipline. But hey, robots are cool. Along with the fun, I suppose you can learn good style with Python, so perhaps they have the second point nailed too.

The best example of teaching programming that I've seen to date is Moby Scheme + Project Bootstrap.

They accomplish goal #1 above by targeting the Android phone platform. Students can write games and apps that make use of the phone's GPS, accelerometer and networking capability among other items. Definitely no boring code here.

They accomplish goal #2 by using a modified version of the Scheme language known as the Beginning Student Language. Because of the rules of the language, students end up with small, easily testable procedures. This starts students down the path of learning important lessons about modularity and debugging, and avoids dependence on global variables or other habits to be unlearned later.

The Moby Scheme project is still in its infancy - but I think the team is really on to something.

So, you heard it here first: MIT went from Scheme to Python, and in a couple of years, will be back to Scheme.

6 comments:

  1. You sure have a weird definition for "fun" in programming. I remember that the time period that I had the most fun in learning computer science was pure lambda calculus. No, not even Scheme or Lisp, but pure lambda calculus, without even number defined.

    The idea that "fun" means something, you know, fancy, showing-off, palpable is extremely consumer-centric, and will ultimately produce bad people, leave alone programmers or not. Isn't abstraction fun? Isn't getting down to the root of all calculation fun? Isn't emerge in sea of either extremely low-level system work or extremely high-level theories fun?

    If the education system cannot spread these kinds of fun, well, all we have is Windows-like. All interface; all fancy; all flashy; never mind about buggy code, stupid ideas, security holes; as long as you have a pretty face, you have created a good program.

    Yeah, right, that's good education right there.

    ReplyDelete
  2. Ben:

    Note that the person you are quoting said "computer engineering", not "computer science". In other words, programming for hardware. Hardware APIs are often exactly like what was described: 300 page manuals that are filled with errors, nothing at all like the Google Finance API or the JDK. The forum effect doesn't apply; I've been handed a piece of hardware that nobody else in the world outside my company has ever seen, and told to get my application running on it.

    If you think of computer engineering as the area between electrical engineering and computer science, then the Android programming you describe is sort of between computer engineering and computer science. My current job is programming for cable boxes, which is similarly in a grey area.

    In the end, I think what it comes down to is that Python is simply a more appropriate language because of its practicality. I love Scheme, but it's something to putter around with on my spare time. The line on my resume that says I know Scheme and Haskell has yet to elicit as much as a comment from an interviewer.

    Magice, you said:

    "The idea that "fun" means something, you know, fancy, showing-off, palpable is extremely consumer-centric, and will ultimately produce bad people, leave alone programmers or not."

    I don't see how "consumer-centric" is ever a bad thing. The vast majority of CS majors won't go into academia where they can afford to not be consumer-centric; instead, they will work in industry jobs where the ONLY thing that matters is the consumer. More often than not, this means using good abstractions because in the long run the consumer will be more pissed off by bugs and new features taking forever, but "purity before practicality" is not a good idea to get into the heads of students.

    ReplyDelete
  3. Imagist -

    That's an excellent point about the difference between computer science and engineering.

    I buy that I was probably inappropriately applying the state of one industry to another.

    One of the key points of the article is that the language switch was made exactly because it was practical to do so. And I think that was a smart move.

    At the end of the day, you should be teaching programming concepts, not language preference.

    -Ben

    ReplyDelete
  4. just a quick comment on the comp sci vs comp eng... traditionally (historically) engineering programs leaned towards implementation and architecture, you know things at a very low level like assembly programing and machine language. CS was more concerned with 'math' topics like maps (not GIS), sets, trees, encryption/compression and such, you know the core tools we see in most modern languages. But over the years the line has gotten much finer and basically they have become almost redundant at most schools. then throw in CIS and ...

    anyways, I have an engineering degree but most of my 'programming' courses (C/C++, Java, OpenGL, data structures, etc) came from the comp sci department, and most of my design courses like Object-oriented, database, project design and jazz like that came from my engineering courses. but then again most of the courses had both a CS and a CpE course number. again the line between the two programs is very vague these days.

    As for why MIT is switching... well I happen to like Python, it is simple and has a robust set of libraries, but the best reason I like Python is for its quick prototyping ability. You can write some pretty significant code quickly in Python and then if you find you really need big speed bumps you can easily port to other languages, like java and C, heck I've even ported to Fortran. Heck for my India travels, I've printed a few articles on doing functional programming with Python, so maybe it will be useful for porting that direction to.

    ReplyDelete
  5. Magice -

    I think you missed one critical part of my suggestion - I was talking about the *intro* level course in CS.

    That is, what's the first taste a student gets of programming.

    Don't you think a NON-CS student would be more likely to go into CS if their first taste of programming was in developing a mobile game, rather than learning lambda calculus?

    I agree, though, you do need to transition from this "look at the neat thing I did" stage to "look at how beautiful these constructs are" - but that can and should happen over time.

    And that's why I think it's important to not only get their attention with something fun, but also instill good habits. As those habits, are going to serve them well if the continue in CS.

    ReplyDelete
  6. I had to use Python for a few years and find its warts before I could appreciate Scheme. I'd say Python is the perfect language if I weren't a PL nerd!

    I think MIT made a good decision, as long as they stick with Scheme for the core CS curriculum.

    ReplyDelete

LinkWithin

Related Posts with Thumbnails