What Programming Language Should we Teach to CS Majors?

Yesterday I went on some sort of massive rant about Java, and programming languages in general. It’s actually kinda ironic that it took me a little over 2500 words to essentially say “I somehow always knew Java was to verbose for it’s own good”. I used to think that it was a good academic language though – because it forces students to think within the OO paradigm, makes them deal with stuff like static typing and has a huge library of classes they could use for just about anything. Not only that but Java is popular and widely used in the industry. So it seems like a perfect match. But is it?

The thing about Java is that it is all about Objects – that is it’s answer to everything. And when the only tool you have is a hammer then every problem starts to look like a nail. Especially since nowadays I see people teaching Java using BlueJ. I really don’t think that works – I think it compounds the problem. I talked to some of these students after they spent two semesters using that IDE and they seemed to be really, really lost and confused. But perhaps I’m wrong and I just encountered the students who were never meant to be programmers.

There is another criticism of Java which I heard – Java students get to reliant on the API. Since they have every possible data structure and algorithm implemented for them they no longer really learn how to do them. The data structures and algorithms classes are just mindless chores to them – they stumble through them, then put them out of their mind – cause why would they ever need to know how a hash table works if they can just import one.

I hear some universities teach their introductory programming courses using Scheme which is the opposite side of the coin – here you teach them a lisp dialect which is a functional language with tons of quirks which is unlike anything else they might encounter in the industry. And while it is great for academia and teaching basic concepts (scheme trained students actually understand recursion very early on) it is unlikely they will actually find a job working with Scheme out of school. Arguably though, the jump from Scheme to Java should be easier than the other way around.

And then there is C++ with all it’s quirks and infuriating little issues. Should we just teach C++ as the initial language and make the students get down and dirty with manual memory management? Some say that this low lever familiarity with your hardware will make you a better programmer – and I’m not opposed to this idea. I don’t have a strong C background but I always wished I did.

Or perhaps we could just do C# which straddles the gap between Java and C++? It offers the best of both worlds so to speak and is also very popular in the industry these days.

Or should we go with the flow and pick something that is both popular, elegant, duck typed, interpreted and easy to pick up like Ruby? It would be an interesting experiment to see how it would fare as “the first” language.

What language did you learn first? Which language do you think we should be teaching to the new CS majors right now?

Which language should we teach?
View Results

Do you think that ability to deal with the low level thinking that C++ imposes on you is really important? Or do you think that academia should teach them how to program using high level abstract concepts first and foremost?

[tags]programming, java, c++, c#, ruby, python, scheme, university, cs, computer science, teaching[/tags]

This entry was posted in school and teaching and tagged . Bookmark the permalink.



15 Responses to What Programming Language Should we Teach to CS Majors?

  1. Steve CANADA Mozilla Firefox Windows Terminalist says:

    This goes right back to your “rant” called “What is this address bar you speak of” in which you wrote:

    The level of computer literacy did not increase. The kids learn to use computers very early, but they do not learn how to understand them. The myspace generation has no fucking clue about technology – all they know is how to awkwardly browse the web and IM eachother all day. Nothing else.

    The problem is similar. CS Majors are learning how to use specific applications, NOT how to program computers. I know guys that could program in freaking assembly language!

    This problem does not solely exist in the hi-tech realm. Look at the sad state of the English language! People using “your” instead of “you’re”; inability to know when to use “their”, “they’re”, or “there”; “loosing” vs “losing”. Pathetic.

    Don’t even get me started with people ending sentences in prepositions…like “What are these address bars you speak of” :)

    Heh

    Reply  |  Quote
  2. Craig Betts UNITED STATES Mozilla Firefox Solaris Terminalist says:

    I think we need go back to basics when teaching programming. I have noticed an alarming trend with the amount of bugs and just poor coding altogether. I blame most of it on OOP. Of all the engineering areas I support, the young OOP programmers cause the most problems. The code written in older, top-down languages seems to do a much better job.

    I can honestly say that learning Pascal was the best thing for my programming skills. It taught me how to prevent from writing spaghetti code. Also, assembly language taught me to code efficiently, another lost talent in today’s market.

    Reply  |  Quote
  3. ZeWrestler UNITED STATES Mozilla Firefox Windows says:

    An interesting conversation I had the other day with my buddy. His students are from a Java background and they are now in an OS class, getting their hands dirty in the kernel code. The problem is, many of them have issues with C where they don’t realize you have to delete your objects, and don’t realize what a pointer is/how to use it.

    In short, it most likely depends on what you want people to be able to do when they graduate.

    Reply  |  Quote
  4. Ben UNITED STATES Mozilla Firefox Windows says:

    I like C or C++ just to force them to deal with pointers. I believe that pointers are the first serious abstraction that CS majors faced when I got my undergrad. People who don’t grok pointers usually can’t grok interfaces or dependency injection. Force kids to deal with abstractions in a way that causes them to fail until they understand. It’s too easy to fake understanding with interfaces and other large scale concepts. When I hire a college grad, I expect their code to suck for at least a year, so it doesn’t matter what language they learn. What I care about is if that person can think.

    Reply  |  Quote
  5. Nathan UNITED STATES Mozilla Firefox Windows says:

    I think Python would really be a good starting language, with its clean syntax and advanced features and automatic memory management. Plus, it forcesteaches students to indent correctly :)

    The first language I was taught in school was C++, and I think I turned out OK. As someone who now makes his money as a low-level C programmer, I think bits and bytes and manual memory management and dealing with that sort of pain/character building experience is important as well.

    I think introductory classes should be taught in a variety of languages, maybe with the first class or two taught in Python and then a quick move down to C++ or C for memory management, then a quick move up to C# or (sigh) Java for applications programming. After that, I think students should generally be allowed to choose their own language, except in courses like OS where obviously C or maybe C++ is the way to go.

    Reply  |  Quote
  6. Adam Kahtava CANADA Mozilla Firefox Windows says:

    When I went to College we worked through two separate books both of which were authored by the faculty. The first book was on C and we had two half-year courses to work through that book, the next book was on C++ and we covered it in 3 half-year courses. Each of these half-year course built on the prior course, and each of the assignments built on the prior assignment – in the end we create a Wumpus type text based RPG game. In addition to our core programming courses, other courses like abstract data types and SQL were taken in parallel. Learning C before C++ was really great for contrasting the two languages, and learning abstract data types as you’re programming with them was really beneficial.

    I vote for C / C++. In the end it will give the students more context for languages of tomorrow, and will let them choose their own programming language preference when entering the real world.

    Reply  |  Quote
  7. Luke Maciak UNITED STATES Mozilla Firefox Ubuntu Linux Terminalist says:

    [quote post="2306"]CS Majors are learning how to use specific applications, NOT how to program computers. I know guys that could program in freaking assembly language![/quote]

    Very true. You hit the nail on the head – they are not learning to program, they are learning how to use Java to accomplish tasks. And that is the problem. The language you learn in school does not need to be the language you use later. This is why Scheme kinda works for some universities. It lets them cover concepts without heavily relying on some particular framework, or tying users to some specific syntax – since it is implied they will need to pick up another language later on whether they want it or not.

    Oh and btw, I could program in assembly and I’m really not that old. I’m probably very rusty but I bet I could do some simple stuff on SPARC if I needed to. Also, I can do Jasmin. So it’s not such a dying skill yet – although I have to admit that the only time I actually did assembly was in school – never needed to use it in the real world.

    @Craig – heh, I started with BASIC. Then I learned some C in HS but my university was a 100% sold on Java. I didn’t have to use C or C++ until my last year of grad school when I got to do parallel programming on a linux cluster. Yay segfaults, unbounded arrays and pointer arithmetic!

    I admit that my C++-foo is weak though. :P

    @ZeWrestler – good point. But I guess the point of a BS in CS (hey it rhymes!) is to give you a well rounded background that would let you do just about anything later on.

    If you know how to program in Java, you theoretically know how to program in C++ – you just need to sit down with a book and figure out which parts of these two languages are similar, which are different and then just adjust to the new syntax. The main concepts, data structures and algorithms remain the same though.

    The problem is, like Steve said is that these people may know Java, but they do not know how to program. :P

    Reply  |  Quote
  8. Craig Betts UNITED STATES Mozilla Firefox Solaris Terminalist says:

    I believe that pointers are the first serious abstraction that CS majors faced when I got my undergrad.

    OMG! Really? I learned pointers and the whole dynamic data structures thing back in high school! (This was in the small hick town of Bishop, California with a population of 5000, so we were not special by any means) Pascal was the perfect language to teach these principles. Then again, it was UCSD Pascal on Apple ][ computers . . . a lot has changed since then . . .

    Reply  |  Quote
  9. D.Taylor GERMANY Internet Explorer Windows says:

    I agree with you that LISP should be taught before JAVA. But to tell you the truth ‘C’ should be the first hard language taught. They should also be exposed to the basics like Asembly, ADA, COBOL, and maybe a few more. Believe it or not those languages are still in heavy use in the World. It burns my buns to hear a couple of studdents goining on about a C# something or other, knowing that they will hit a COBOL wall in their first job. (think Banking, a big business here) Or Assembly, or even DOS in use on the machined factories running all automated. They need the Basics. IMHO -d

    Reply  |  Quote
  10. Ian Clifton UNITED STATES Mozilla Firefox Ubuntu Linux says:

    [quote comment="8236"]Don’t even get me started with people ending sentences in prepositions…like “What are these address bars you speak of”[/quote]
    That’s not “wrong” in English. In Latin, you could not do that and somehow people think that automatically makes it apply to English, but it doesn’t. We’ve been ending sentences with prepositions for centuries. In fact, we use phrasal verbs in English quite frequently, which can often require that a sentence ends in a preposition. If you ask me for the definition to a given word and I respond, “Look it up,” that is a perfectly fine use of English. In that case, you can’t transpose the pronoun and preposition.

    As far as the subject of this post goes, I’d say C++ or Python would be best. C++ would teach the students a lot more, but it may scare some away. Concepts like pointers are very difficult for many people. Python is probably much easier to teach. The question is whether you want efficiency with the coders or the code.

    Reply  |  Quote
  11. Miloš UNITED STATES Mozilla Firefox Windows says:

    I echo the comments made about C++ (and C for that matter). It is the first programming language I learned and it has proven to be the best for serious development. Since then I’ve experienced Java, Assembly and few others, but a lot of them are like piecing the puzzle together and are based on more rapid development then sound, structural code that works.

    Reply  |  Quote
  12. Luke Maciak UNITED STATES Mozilla Firefox Windows Terminalist says:

    Just to clarify, I firmly believe that every student working towards a degree in CS should at some point work with C/C++ (to see how things when you can’t or may not want to relly on garbage collection and other niceties like that) , some assembly language (to see how it is to work at this very low level), lisp (to get a taste for functional programming) and something like prolog or haskell (declarative programming).

    They should also look at the theory behind programming languages and the way to formally define them. They should get well rounded education. But you have to start from something. And as much as I like lisp, I really think that the foundations should be laid in an imperative programming language – just because this is what most likely the students will be dealing with on the daily basis.

    Again, this is the language you use to teach them how to make a loop, how to declare a variable, how to initialize an object and etc.. And for most people this first language becomes the primary language they will be working with for years to come – just because it will have that familiar and comfy feeling to them. And this is why the choice of this first language is important.

    On one hand I would agree with most of you that C is probably a good place to start. But then again it is like teaching someone to swim by tossing them into the deep end of the pool. The mere fact that C++ doesn’t have a native string type or that you can gleefully write all over your available memory if you don’t check array bounds just adds to the confusion.

    So teaching the basic concepts in a more abstract language nay not be such a bad idea, as long as you set aside the time to go back and do the hard stuff in C. :P

    Reply  |  Quote
  13. ths UNITED KINGDOM Mozilla Firefox Windows Terminalist says:

    I started to learn programming end of the 70s on Sinclair ZX81 and Apple II (yes, the Applesoft Basic was licensed from Microsoft, and it was really good — technically, internally). It fitted in 10 KB ROM. Unbelievably today. It was so great when the assemler listing of the DOS and the Basic were sold as books. First thing on my wishlist for Xmas that year ;).

    The BIOS of the Apple II was contained in the appendix of the user manual, and I still am fascinated what Woz did achieve in 2 KB ROM. He had the BIOS itself with IO, cassette interface for saving/loading, speaker and even code for lores graphics, a 6502 disassembler and a CLI for entering machine code (the “monitor” — call -151 ;) ). I think there are only a handful of people who could or can understand the Apple II disassembler and its inner workings.

    Very soon I was annoyed by the lack of abilities in fpbasic (I missed if-then-else, local variables and so on), and switched to 6502 and Z80 assembler (a friend had a ZX spectrum then). Then I tried UCSD pascal on the Apple and liked it very much for some problems, and it had a nice graphics library, based on the vectorial Logo approach. I guess noone today remembers that language ;)

    Out of interest I got me a Z80 card for the Apple II and tried CP/M. Then I wrote a CP/M clone in 6502 assembler, but it lacked applications ;), so I abandoned that. Anyone still remember the A.U.G.E. (apple user group europe)?

    Still at school I started reading Wirth’s books about programming and compiler construction, then bought the dragon books (I later met Aho and Weinberger when I learnt awk ;) ), because they had more details.

    When I had a 286 PC after starting university, I used Turbo Pascal a lot, but got annoyed by having to write everything myself — but for sure, I learnt a lot then. I bought the database module, and didn’t like it, so I rewrote the library to fit my needs, and learnt something about DBMSes.

    I switched to Turbo C because I liked the C library very much.
    Then I switched to OS/2 and IBM’s C; this was my first dive into GUI programming and the event-driven model there.
    In the meantime I had met unix at university, and switched to gcc on my private OS/2 system with its wealth of Unix tools, and since this time I’m an unix addict ;); I even contributed to the gcc OS/2 C library a bit (emx runtime).

    I learnt C++ out of interest, but had never a dire need to use it for anything; I could do everything in C, and with some decent tools for catching memory allocation problems and profiling I got quite stable programs with a userbase of ~100. I wrote a nearly complete BBS and mailer package for OS/2 to participate in Fido and ran a mailbox with 3 lines for nearly 10 years until a headcrash ended that in 2001.

    At the computing centre of the university where I worked first I was hit with AIX, SunOS and IRIX. I learnt perl and love it until today. perl5 is a great sysadmin tool, and if you have selfdiscipline you can write readable programs. I’m not the guy for golfing, although I respect and enjoy some of their code ;)

    I encountered Java at some occasions in my professional work and still loathe it. When IBM bought Tivoli they had a great tool with a good concept and good automation by CLI for installation and operations (it was written with gcc mostly). Then they bought more companies, added Java here and there, mostly for GUIs, some even for background (daemon) functions, and dropped some automation capability, and over time, gradually, it got worse. Now there are even daemon functions which use a Websphere framework, i.e. they are contained in an EAR. So bloated … ;(

    To summarize it all: I think Pascal is a good language for learning concepts. Then you should go C to learn more about data structures and mistakes you can make. I firmly believe in Wirth’s principle that the data structures must be designed first, then the code follows the structures. I had very good experience with this concept in over 20 years. After C there should be some OO language, be it C++, C# or Java, I don’t care what exactly. The teacher must nail down the concepts, not the particular language. For databases it’s important not only to learn SQL, but the concepts of storage, indexing, and so on. There’s much more than coding — it’s understanding the problem and choosing your weapon wisely.

    For my professional work I had to learn Prolog (still use it today), and it was not very hard.

    I think the “how to shoot into your foot with programming languages” has a very good point, you can recognize goods and bads of each and every language there.

    And remember: a good programmer only ever needs to ask 2 questions when learning a new language:
    1. what’s the end-of-line character
    2. what’s the comment character

    Reply  |  Quote
  14. Alphast NETHERLANDS Mozilla Firefox Linux Terminalist says:

    Funny. I am in no way a programmer, but I did study algorithms in high school and programming in my first year at University. And I had an Atari at home. So I actually began writing small programs in GFA Basic (that was 20 years ago) and later followed a Turbo Pascal course. But I dropped engineering at the end of that year and never had to write a line of code since then.

    As for preposition at the end of a sentence, it is a feature of all Germanic languages (of which English is a far cousin). ;-)

    Reply  |  Quote
  15. JuEeHa FINLAND Mozilla Firefox Mac OS says:

    Steve wrote:

    The problem is similar. CS Majors are learning how to use specific applications, NOT how to program computers. I know guys that could program in freaking assembly language!

    I don’t really understand why many people think programming in assembly is so hard. I have written over 30 programs and a multitasking operating system with assembly and I am just 14 years old. (Maybe my background with C on MS-DOS at the age of 8 has something to do with it. I actually ditched Windows 95 after I found how to use DOSSHELL in early 2005 and even after getting a new computer in late 2006, I usually booted to DOS using a boot floppy and only booted to Win2000 when I had to. Only after I started using linux in 2007 I stopped using DOS(at the time using FreeDOS instead of MS-DOS) as my main OS.)

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>