

Ask HN: How should programming be taught at university? - samlev

I have brought this up in a couple of communities, and the response is always interesting, so I'm going to bring it up here, too.<p>I believe that the way programming is taught in university (in particular "Intro to programming" courses) is wrong. This year I had a couple of friends struggling with "Intro to programming" courses, and it made me reflect on what I was taught when going though a similar course at my own university.<p>My course, as well as the courses my friends were attending, were all trying to teach Java as a first language. There's nothing inherently wrong with learning Java (it's popular in big business, and that's where Universities are trying to aim their graduates) but something about the way that it's taught irks me.<p>I think that it's safe to say that Java is a fairly complex language. The JVM removes some annoyances that experienced programmers have had when trying to build a multi-platform systems, but it comes with a boiler-plate overhead. Most IDEs will deal with this automatically for you, so when you get to actually using the language, the boilerplate overhead isn't an issue. When you're learning not just the language, but the concepts of programming, then the boilerplate is horrible, scary, and confusing.<p>Now most programming courses will start with "getting the JVM and (inevitably) NetBeans running", followed by a quick trip down "Hello, world!" lane. Most teachers seem to think that the achievement of writing your first compiling program should be the thrill needed to spark further interest in programming, but in reality by this point they have taught students how to copy and paste. Some students will have managed to fail at that, too. And why? Because the boilerplate makes no sense to non-programmers. The fact that these nonsensical lines have to go in a specific order, and have to be typed in an exact way isn't always inherently obvious to a 'fresh-out-of-high-school, copy-down-notes' student. Crazy, I know.<p>The next problem will arise when some student who fool-heartedly assumed that they paid tuition so that they could be taught things dares to ask "what does 'public static void main' mean?"<p>The answer I got when I (yes, I was that fool-hearted student in my class) asked was the same answer related to me by both of my friends in their respective courses. "Don't worry about that, just put it in. The program won't work without it."<p>That's not a good enough answer. You can't teach someone to program by telling them to ignore parts of the program (but to include them anyway or the magic won't work any more). What's more, if a student asks you a question about something, you shouldn't fob it off with a bit of "you wouldn't understand".<p>So point 1: I think Java is the wrong choice for a "first language". It has abstracted away problems that new programmers shouldn't be entirely ignorant of, and replaces them with confusing boiler-plate, and high-level concepts that really require previous programming knowledge to properly understand. Python, Ruby, Perl, JavaScript, or even, dare I say it, PHP would be better suited to the task because, as primarily "scripting" languages, they have the least overhead possible to doing something useful. Introduce the other concepts (objects, imports, abstraction, class inheritance, etc.) after you have gotten them comfortable with the basic constructs.<p>The next thing which bugged me when I was learning was this idea of "We haven't reached that yet, so you can't use it". I ran into it again when my friends asked me for help. They asked about simple problems which had common, well known solutions, that they weren't allowed to use because they hadn't reached that chapter yet.<p>I know that it's good to understand what a function does before you use it, and especially before you rely on it. I get that, I really do. But a big part of programming is research and discovery. Telling people, especially students, that they're not allowed to research solutions; that they must "roll their own" using only what they've already been told; that leads to home-made encryption, and poorly implemented variations of the standard libraries. That couldn't be further from productive. This is also made worse by 'learning libraries' (when I learned, we used one called 'BreezySwing' for all our GUI stuff) which aren't common standards, don't behave like the common standards, and can cripple a new programmer's understanding of some topics.<p>So point 2: Discouraging discovery, and worse, encouraging distrust in common standards (or at least teaching with non-standard libraries) just weakens the programmers. Instead they should be encouraged to find and research the 'best practice', and to understand how it works (stopping short of rebuilding it from scratch). I'm not saying that they should be taught to blindly trust other people's code, but they should be taught how to find and analyse existing solutions to a problem. It's all part of playing nicely with the programming community at large, and it takes a lot of time to re-train fresh-out-of-university programmers out of the idea that "security through obscurity" is a good thing, or that their half-remembered cryptography subject two years earlier puts them on par with the leading minds in the industry.<p>So that's my opinion. The way "programming" is taught needs an overhaul. I could probably pick out many more points, but they're the big two issues that I have with both how my university course was run, and how two other university courses (both at different universities to mine, and one is a different country) were also run. From this sample of three, and discussion with other people who have gone through similar courses, I'm left to assume that this method of teaching is pretty common.<p>So I ask you: How SHOULD we be teaching programming? What should an "Introduction to programming" course actually cover?
======
apaitch
I learned Scheme in my intro to programming course and I loved it! It was very
lean, simple and straightforward. No voodoo, everything is explainable, and an
easy substitution-based "debugger" to step through your code.

On a side note, I don't think modern-day students will ever be exhilarated
when they get "Hello World" to appear in command-line output. In the day of
Pixar films, 3D games, etc the simple outputs are underwhelming. The
exhilaration comes from making a program that solves a problem (real or
artificial) and overcoming challenges along the way :)

------
caw
Point 1: Georgia Tech uses Python (CM & CS) or Matlab (everything else) as an
intro language.

Point 2: You're not allowed to use certain solutions because the homework is
to implement what you learned in class. Yes, your linked list will be
implemented iteratively, recursively, in Java, in C, etc etc. Yes this leads
to homegrown libraries because then you'll turn around and use this same code
in your next homework, because it builds off the prior week's. Or if you
failed horribly the TA releases theirs but of course they've implemented it
differently than you so there's a learning curve if you have to modify the
code. Then after that, you can use the built-ins (unless it's been decided you
have to implement your data structure with yet another nifty feature). It's
teaching fundamentals.

With the homegrown libraries, the closest I ever saw to that was the LC3
assembler we had to code in. But everyone knew it wasn't x86 assembly and it
was for learning purposes.

At the other extreme: I actually learned C without any libraries because it
was taught using a game boy emulator. We didn't even have printf for
debugging. Now go in to your next C class and they assume you know the
libraries. I once tried to re-implement "atoi" because I didn't know it was
standard.

------
steventruong
1\. Some Universities (at the very least MIT) have begun teaching Python as an
introductory language and hopefully others will follow suit.

2\. Stanford CS106A class which has been online for some time now is one of
the better intro classes I've seen. You can breeze through it just to get a
rough idea. The core focus of that class was less about language and more
about software engineering principles.

That said, I think all classes are far from perfect and can still be
reinvented. Like any other class in any school (K-12 or Universities), I
believe education is busted in many ways much less how a given class in any
subject category is taught. If anything, its not unique to just CS or
programming and I think realistically, it needs to change in a lot more ways
than one.

------
codeonfire
I agree that the way programming is taught needs an overhaul. But I don't
think programming should be taught at all.

Students should know programming before they get to college. Do music students
who go to music school all spend the first year learning guitar together? That
thinking is from the olden days when programming was a job. Today it is an
art. The cold war refrigerators and punch cards are gone. Here is how it
should be done: Students enter the school and are given a variety of starter
options: game programming with python, web programming with rails, numerical
computing with c, classical data structures, etc. Then, students audition in
order to take advanced courses. The audition is two parts: technique and
style. Technique is judged on traditional things. Did they display good class
design? Did they define a good data model? Did they use show a high level of
knowledge of whatever language they used? Next is the style component. Is the
project "good". Does it follow modern tastes in software engineering? Does it
follow modern tastes in UI design? Is it meaningful and relevant to the world?

The key part is that applicants are put on notice that their entry into the
real program depends on their demonstrated prior progress as programmers and
CS students. If only 10 kids show up, so be it. That is all the students that
formal education will be useful for. Teaching programming to CS students is
like teaching the greek alphabet to history students or welding to mechanical
engineering students. It's something they should already be way into,
otherwise it's not really productive for anyone. I for one am tired of seeing
programmers who can't think for themselves, who can't do anything without
being told the answer like a robot. They second guess everything that isn't
written down and schedule endless meetings thinking someone will be show up
with the answer for them.

------
kung-fu-master
As school teacher I think that "Introduction to programming" should increase
motivation on further learning of programming.

About 10-20 years ago it was very simple task. Computers and programming were
very exciting.

What has changed? Nowadays there are a lot of interesting and distracting
factors like computer games, TV, Internet etc.

I think our primary goal is to make learning computer science more interesting
and fun. It must be more interesting than computer games and TV. It is really
interesting than computer games! We just need to show that for our students.

How can we do that? For example, at our school I have made 3D robots simulator
which has own simple programming language. Students are programming virtual
robot to reach some goals. It's like game. Also I have made "real" robot based
on Arduino with IR sensors.

As a result I can see increased interest and motivation of my students.

------
sitkack
I would use a full web hosted IDE, that way everyone can just click and they
have a usable dev environment running. The mechanics of programming are
orthogonal and often much harder than programming itself. Skip the dev env
setup and go directly to solving problem.

Next, they need to understand WHY they are solving problems. Teach them high
level concepts and then low level implementation.

Induction, recursion, depth first, breadth first traversal. The New Turing
Omnibus is a great place to start for algorithms plus applications. Python is
OK, but I think too mutable. Scheme is way more powerful, maybe something like
a cross between Scheme and Python, OCaml Lite in the browser?

