Thursday, February 21, 2013

A Friendly Survey of Programming Languages

I was sitting around thinking about high school computer science curriculum last night when the idea of a programming languages survey course came to mind. I’m a firm believer that spending all on ones time learning just one programming language in high school fails to take advantage of how quickly students learn new languages. It is has been said that the hardest language to learn is the second and that after knowing two the rest become easier. I believe that. So what if we created a course, maybe even a semester course, that stuck to the very basics but introduced several programming languages? Suppose we included several programming paradigms as well? What would that look like?

I was thinking that you’d teach using one of the block programming languages for one. Pick one of Alice, Scratch, Blockly, Appinventor, or Snap! Doesn’t matter – pick the one you like best. Then include a couple of traditional programming languages.

Pick at least two with no more than one being a semi colon and curly brace member of the C family. So one of C, C++, C# or Java. Again which ever one you like best. For an other language pick one or two from Visual Basic (or some other Basic) and Python or something else you like. PASCAL anyone? I recommend you use Visual Basic though. Controversial perhaps but I can think of a couple of reasons.

One reason is that the Select/Case structure is much more powerful and flexible than the switch/case structure in C family languages. This is driving me crazy right now teaching C#. Also the AndAlso and OrElse keywords compared to And and Or really help bring home short-circuiting. Plus it lets students see that those semi colons and curly braces are not the only way to do things.

Python is also a good choice as it is a powerful dynamic language that is growing in use everywhere. I think that using a good dynamic language is a plus for this sort of course.

Lastly I think you need a Functional language. Scheme, Lisp, Ratchet or perhaps F#.  Not having a good background in a functional language is a big hole in my own background and with functional languages becoming more popular all the time I think students should have some exposure to the paradigm.

There are lots of options in all categories of course and I would expect different people to pick different languages. I would probably pick: Scratch, C#, Visual Basic, Python and Ratchet (or maybe F#). With Visual Studio I can teach/use C#, VB and F# all in the same IDE which could save some time and allow code from a project in one language to be used in a project written in another. But maybe there is some value to using multiple IDEs. Different strokes for different folks.

I would not try to “boil the ocean” and get students totally up to speed in all languages but would focus on key concepts that are fairly common to all languages.

  • Variables and Assignments
  • Arrays
  • Loops (for and while)
  • Decision structures (if and switch)
  • What else?

Maybe a few other things that are done particularly well in one language or paradigm and not as well in others. What would you include?

I don’t see this as a replacement for a university level Programming Languages course but as a gentle introduction to the various ways that syntax effects how we look at programs while keeping some key concepts constant.

I don’t see this as a first course. Maybe not even a second but also not the last that they take in high school.  I would want to get students to want to learn new languages. I would also want them to see different ways of doing things before they get too set on their ways. Open minds rather than just fill them.

What do you think? Am I crazy? Are my groupings off or missing something important? What languages would YOU select? Is 5 the right number of languages or too many? Too few? Should assembly language be included? I wonder about that one. I’m looking to start a dialogue not present a finished product. So please leave me some things to think about.

13 comments:

Edward Bujak said...

Your goal is noble, but time will be the killer. In a semester course, you cannot do any detail if your compare say 5 different paradigm CS languages, but I would add functions/methods/subroutines along with parameter passing. That being said, you should cover binding: static, early, late. Oh yeah, and don't forget how data types are handled in these languages. And maybe illustrate PROLOG.

Kathleen Weaver said...

I took a course like that in college -- I think it was the third course, and it was after assembler. We spent two weeks on a language, I think, maybe three. Wrote a couple of programs that emphasised the features of the language.

Snobol and APL were my favorites.

Jim Peters said...

You list pretty much hit everything on my "goal" list for the entire PWD curriculum in 3.5 years. I'd add teaching the concept of functions or sub routines so the students would start to understand how to chunk their code and begin to think about how to re-use.

Alfred Thompson said...

A single semester might well not be enough. Hard to get more year long CS courses though. I'd like to talk about some languages in parallel rather than one after an other. A side by side sort of comparison is a textbook I have long thought about writing.

Lou Zulli said...

We teach C# in the sophomore year, Java in the junior year as part of our AP CS course and our OOP class. We are planning on a course in Python as a senior level course next year possibly to replace our AP CS course. We also offer a course in game design that dabbles in C++ in the second semester. Yeah, most of our students are code geeks.

Garth said...

I have always been a fan of teaching multiple languages in high school. Although the kids may not become experts in a language they learn how to learn a language. As for the languages themselves I think it is more based on what the teacher is familiar with than the language itself. I do Scratch and Small Basic in Semester 1. For a one and only programming course these two will give the kids enough to do both a block language and a line language. I sometimes squeeze in VB so they can see a commercial grade IDE but it is more a show and tell. Second semester I do what I want. I get bored with the same thing every year and I really do not think the actual language the kids learn is important. I have done Mindstorms robots, Arduino, Kinect with Scratch, C#, VB, and Corona. They all make the kids think.

indelicato said...

Back in the dark ages of magnetic core memory, I learned Basic, Fortran, and Assembler on my own in high school. In college (RPI), I placed out of Fortran (actually, a flavor of Fortran developed at the University of Waterloo named "WatFor", and it's update named -- wait for it -- "WatFiv") and took PL/1, then IBM 370 Assembler, then Pascal, and then 6800/Z80/PDP-11 Assembler (in one course!) Then, similar to Kathleen, I took a course called "Four Computer Languages" as a senior (APL, Lisp, Snobol, and Pascal again).

At my school I've taught VB for 13 years, followed by C#, and then APCS. But last semester in a two-week "Introduction to Computer Science" out-of-curriculum extension in my freshman class, I experimented a bit and introduced Turtle Graphics with surprising success. (Surprised me, at least.)

So what would I teach now? Coincidentally enough, we’re revamping the CS offerings as we speak: The freshman Microsoft Office class will be replaced with Explorations in Computer Science, which will actually teach some basic CS concepts to all freshmen. Included in this course will be an introduction to programming, probably VB. Our goal is to “whet the whistle” of students who would have never considered programming classes otherwise, and therefore wouldn’t be a full Intro to Programing class. It will probably just cover variables, decisions, and looping, but not arrays, functions, or other advanced topics. The current VB and C# courses will essentially be merged, leveraging off of what the students learned as freshmen. Given that it’s a one semester course, I’d do what Alfred suggest and teach either VB or C# (or both?), because I wouldn’t have to teach the IDE. But I’d go in directions I couldn’t go with the current courses, including possibly mobile app programming (Windows Phone, anyone?) Then we’d have the APCS course (in Java, of course). By streamlining the VB & C# courses, the path to get to AP is shorter, which who knows, might just result in higher enrollments.

Pete Welter said...

In general I agree with the scope of your languages and base set of topics - that's a great base. To the loops/variables et.al. list I'd add functions/modules - in particular calling library/APIs and the related parameter and return concepts. For many apps, the style becomes stringing together the right set of API calls with a bit of logic and data structure design behind it.

The other part that is missing is letting the students create something they care about. If there is a project they want to do, there's almost always a reasonable teaching language to support it.

Mike Zamansky said...

I like exposing the kids to multiple programming paradigms and think it helps to expose them to multiple languages.

Two of the questions I always ask when designing a course or sequence are how do I want the students to think and problem solve and what do I want them to be able to do.

That has generally driven my language selection.

It's the reason why I put Scheme in Stuyvesant's intro course (10th grade). I like functional programming first then other paradigms and while you can do functional in other languages, scheme's restrictions really help the students learn how to think functionally.

We then picked NetLogo for both its parallel nature as well as its interactive nature and strength in modelling.

We can do a pretty good job with two languages in a semester. The second half of the intro class use Python.

In our junior year we've got Java, but that's due to ETS and the AP course.

Our seniors learn C if they do System Programming and Python and Javascript for software development and graphics can be done in anything.

We chose each language for specific reasons - each highlights a different paradigm and makes you think about development in a different way.

I didn't mention any of the DnD languages because, well, I'm not really a fan.

Anonymous said...

Back in '91 we had a semester course on programming language concepts, in the third year of a five years long software engineery degree. By that time we had a background in Pascal, C++ and some SmallTalk so we could follow it. The course didn't focused in learning the languages or how to program with them, but language concepts such as heap versus stack allocation, parameter passing, scopes, methods resolution and lookup, binding, etc. This way we covered not a handful but literally dozens of languages in a semester. With that kind of background you could then learn any language easily. The course was heavily based on this book: http://www.amazon.com/Programming-Language-Concepts-Carlo-Ghezzi/dp/0471104264.

hutch said...

Alfred I have the opportunity to possibly have students take 3 CS courses in high school. The first two are introductory in nature so I use App Inventor in one and Python in the other. In the final course I move to Java with O-O and I feel that this exposes students to a wide variety of different languages and techniques. I am not a big fan of using a single language as they are all simply tools and I don't use a hammer everytime I go into my toolbox to fix something at home.

Anonymous said...

I'm not a teacher but I am a professional programmer (.NET). From my perspective it seems like the best thing to do is to focus more on the concepts and not the specific languages. Pick languages that exercise the concepts you want to teach and as you go maybe also show the contrasts between the languages, demonstrate how certain languages were designed to make certain problems easier to solve. Problem-solving is what it's all about anyway, and as I've grown over the years I've learned to focus on the problem first and then on finding the right tool to solve the problem. That's what computer languages are, tools to solve problems, and each language has its unique perspective on how to solve different problems.

In the end, I don't think it really matters what languages you choose. If you arm your students with a good grounding in the concepts then they have a better chance of being successful. That said, more main-stream languages are probably better, since there are more likely to be active communities surrounding them. I don't think I'd start with C/C++ though, unless you're prepared to teach your students about memory management...I can't tell you how confused I was when my high school teacher tried to tell me what a "pointer" is. It all makes sense now, but at the time I just couldn't grasp the concept.

I don't see any languages on your list that introduce data-manipulation concepts (i.e. SQL). The set-based thinking that SQL introduces is very valuable and is quite a shift from procedural-based thinking -- maybe too much though.

Object-oriented concepts aren't on your list, but if you're teaching C#/VB.Net then that's pretty much a given -- can't really get away from it.

Anonymous said...

You're describing one of my favorite classes back in the day in Austin. I seem to recall we looked at ADA, LISP, C++, ML, Modula 2 and SmallTalk. The whole idea was to explore the strengths and weaknesses in the languages and how the paradigm shaped the language or vice-versa. We had a small project for some of the languages designed to exercise one of unique features.