Crappy Programmers

   30 December 2005, late morning

Joel from Joel on Software posted an essay today entitled The Perils of JavaSchools. His main point is a simple one: dumbing down Computer Science programs helps no one. In particular, he talks about schools that only use Java in their curriculum. In doing so, such schools fail to teach what Joel considers to be two important things: pointers and recursion. First off, I should say that I don’t think either is particularly challenging stuff. Secondly, you can cover this material in Java.

I’m no fan of Java, but it is foolish to think you can’t teach kids about pointers or recursion in the language. The second computer science course taught at the University of Waterloo is CS 134, an introduction to data structures course. If I recall correctly, we were taught all about linked lists, stacks, queues, binary trees, and hash tables. You can implement linked lists in Java much the same way you would in C. In C you would probably make a node structure that contains your data and a pointer to the next node structure; in doing so you would need to understand how pointers work. In Java, you would have a node object that contains your data and another node object. In Java, every object variable is actually a reference to some chunk of memory that stores the object. You need to understand how objects are stored in Java to implement a linked list properly. In implementing a linked list in Java, you would need to learn on some level how pointers work. In your course, you may not call them pointers, but that is what they are—more or less. To say Java lacks pointers is correct, but is overly pedantic. Although Java glosses over the details involved while using pointers, you can still get your fair share of NULL pointer exceptions trying to implement a linked list in Java. Similarly, while implementing binary trees in Java, you will again make use of the way objects are stored, and you will also need to understand how recursive algorithms work. Java isn’t a horrible language.

Of course, if all you teach kids is Java, then you can’t hope to cover the more low-level aspects of programming. I think a good programmer should know how to write and debug multi-threaded applications. That’s actually challenging work.

I studied Computer Science at the University of Waterloo. The rate of attrition for my program was supposed be something like 66%. (Two-thirds of the people that start in Computer Science either don’t graduate, or graduate with another degree. Amongst the people I knew, that degree was economics.) At Waterloo, what weeded out many of the computer science students wasn’t the Computer Science courses at all—it was all the Mathematics. People would fail Classical Algebra, fail it again, fail Linear Algebra II, fail it again, and probably fail Calculus II and call it a day. (I am not impressed with the changes being made to the CS program at Waterloo. I told my brother to take Computer Science under the Faculty of Mathematics rather than the Faculty of Computer Science simple because the program under the Faculty of Computer Science sounded a bit too much like Computer Science for Dummies. Waterloo is lucky in that it draws a lot of smart kids to its program simply because of its name. However, I think it fails to push the students as much as it could.)

I agree with Joel’s main point; if people can’t cut it in a Computer Science program, perhaps it’s not for them. Really, this should be true of anything people choose to study: if you are failing in medical school, perhaps you weren’t meant to be a doctor; if you can’t pass your bar exam, maybe you weren’t meant to be a lawyer.

Update: This post is just as rambling as Joel’s.



  1. Phew. I was scared for a moment. My high school used java and didn’t go into pointers. We did a bit of recursion but nothing too big (Fib numbers and stuff). Even in uni we are still using Java.

  2. I don’t think Java is a good programmming language to teach in. To write a simple “Hello World” application invovles classes, static member variables, and member functions, all of which are unrelated to the task of displaying text on the screen. I think if you want to teach the basics of programming, Pascal is a much better choice.

  3. References and pointers are similar, but definitely different. So I disagree that you can understand pointers if you’ve only worked with Java.

    A reference allows you to have multiple variables refering to same “piece” of memory (e.g. object). If you pass a parameter (object) by reference then the function you called is able to manipulate that object.

    A pointer is an address in memory. If you know what type it points to then you can manipulate it, etc. and get all the benefits of references. But, because it’s an address you can do all kinds of other fancy things with it. Everything from manipulating arrays, dynamically executing functions based on their address, determining if a stack grows up or down at runtime, etc. You can also get into things like “smart” pointers, and how memory is actually allocated and freed as well, which are also non-issues for Java programmers.

    I like asking what’s the difference between a reference and pointer in my phone interviews. I’ve talked with a lot of Java programmers lately. No has been able to answer that question yet. It’s disappointing. (People really suck at data structures too. That’s probably what annoys me the most though).

  4. Yeah, I agree with you 100% Ryan. I just wanted to point out that you can give people a good introduction to pointers with Java.

    As I said, I don’t think 100% Java in school is a good idea.

  5. I would say “introduction to references” (and how to use them to manage/manipulate data). ;-)

    Java is a good way to learn Object-Oriented programming as it is “simpler” than C++. (e.g. You don’t need to worry about “virtual” functions).

    But C/C++ are so common (e.g. What applications do you run regularly on your desktop computer that are written in Java?) and C/C++ is essentially the standard/basis for many other major languages (e.g. compare the keywords of Java with those of C/C++). Any comprehensive computer program should include some component of C/C++.

    I agree that Java isn’t a good introductory language. I haven’t used Pascal, but something like it or Basic would be a good place to start.

    Other more diverse languages (e.g. Lisp, Smalltalk, Eiffel, Ada, etc.) are worth touching on (i.e. To show that the C-family isn’t the only kind of [non-scripting] programming language). Also, scripting-type languages (e.g. Perl, Ruby, etc.) are worthing touching on as well. And you better have written something non-trivial in assembly at least once in your life if you want to be well-rounded.

Don't be shy, you can comment too!

Some things to keep in mind: You can style comments using Textile. In particular, *text* will get turned into text and _text_ will get turned into text. You can post a link using the command "linktext":link, so something like "google": will get turned in to google. I may erase off-topic comments, or edit poorly formatted comments; I do this very rarely.