91 comments

[ 3.0 ms ] story [ 115 ms ] thread
I would like to point out before this discussion moves too far along that UCLA does in fact have an introductory programming course which is taught using Python: http://web.cs.ucla.edu/classes/enroll/97/

Students that are unfamiliar with programming are encouraged to take this course before the C++ course.

That kind of defeats the argument of the article then.
CS 97 is even mentioned in the article, but perhaps the C++ course is required for graduation, while 97 might not satisfy that requirement?

Unclear from afar...

piemonkey said that they're encourage to take the Python one first, meaning they still have to take the C++ course as well. The Python one is optional and intended for those who are having trouble jumping straight into C++.
I think fundamentals of programming should be more emphasized not the language itself.
This is all that CS has ever been, and is the reason they're teaching in C++ in the first place (it's a low-level language good for learning fundamentals), which is fine. But a huge part of CS students graduate without knowing how to code in languages that are reflected in the jobs they are trying to get, which are mostly python, javascript, and java. If you think the industry is fine, great, but if you agree with those that think CS degrees should emphasize job skills a little bit, then teaching courses in Python is a good move.
well that is not a Universities Job is it
I’m quite surprised they are still using c++. I thought most schools switched to java by or in the first half of the oughts.
What does it even mean for a school to 'switch' languages? When I did my bachelors it was straight up a new language in each class, at the discretion of the prof in charge. Intro class homework was in Java, data structures was in C++, operating systems was in C, digital logic design was in Verilog, bioinformatics was in Python, ...
Right, and if the professor of the intro class decided they didn't want to teach Java, and would prefer C++, they'd "switch" over to it... I don't see the confusion. C++ isn't the only language in the entire school, this is all about one intro class.
I'm not sure if it was an official policy or not, but at my school, all of the core classes were in Java. Other classes used other languages where appropriate, and "core classes" is not synonymous with "degree requirements"; you had to take classes that used not-Java. But Java was considered the default.

Professors don't like having to waste time in their classes teaching a language, so there's a strong pull to unify as much as possible, so you can be 100% sure that your students have some form of knowledge before they get into your class.

So, the "switch" would be changing that big block of core, required classes.

In large schools, lower-level intro classes can be huge (many classes with many students in each class), so there's usually an extremely standardized (and mechanized) curriculum that ensures everyone learns basically the same thing and labs and recitation sections are interchangeble.

So when they switch languages, they mean moving all this curriculum to another language at once. The higher level courses don't change.

The major shift came when CollegeBoard switched the AP Computer Science exam from C++ to JAVA about 15 years ago.
It makes a lot of sense for non-CS students to be able to learn CS using Python.

For CS students, there's a good argument for starting with the fundamentals and adding abstractions later. It's not the only way to learn it, but if the CS department wants to start there for CS students, that's reasonable.

+1, back when I was considering attending the UC system the fact that Java was taught almost exclusively pretty much removed them from my list. We had UCSD students coming to my local community college to take the C course I was in since it wasn't being taught at UDSD. It always shocked me considering they had a pretty awesome super-computer lab.

Ironically I spend about 90% of my time in Java code. That said understanding the fundamentals is super-valuable when root-causing JNI issues or trying to speed up the VM in cases where normal Java approaches don't cut it.

UCLA is one of the biggest users of CoCalc.com. They use CoCalc extensively to teach a course called "LS30: Mathematics for Life Sciences". Well over 1000 students a year in this course program in Python for hours every week (via SageMath Worksheets) in a lab and at home. The content is really beautiful, and teaches ideas from Calculus in a much more hands on and motivated way. Expanding Python education at UCLA would definitely help support the LS30 sequence.

(Disclaimer: I started SageMath and CoCalc.)

Who is the author that makes them an authority on this? I couldn't find much, but it looks like they are just a student or journalist that writes opinion pieces. Shouldn't the professors designing the courses have much more say than someone that does not appear to be an expert?
It's an opinion piece in the student newspaper. So it's just a student saying "this is how I feel".
CS50, the intro CS course at Harvard, which is notably a large and successful MOOC in addition, is taught in C. It's a really bizarre choice, and only serves to add complexity to a topic that already has a fairly high cognitive barrier to entry.
As opposed to jumping into C++ in all its OO glory?
There is a lot that is factually wrong with this article. Python is not easier because it is an interpreted language. C++ is interpreted too. In fact, python does compile, hence the pyc files. I could go on like this for a while but the point is, the author doesn't know what he or she is talking about. That doesn't mean python shouldn't be used, but that this article fails to make the argument.
on lower-level implementation details related to how machines interpret code – knowledge that non-computer science students are unlikely to use after they graduate.

Yeah, the world really needs a load more developers with no idea how computers work. We don't see any of those in interviews already.

What's with the false dichotomy? I personally agree with you that knowing lower level things is incredibly helpful to every single good developer, even those who don't touch anything lower than Javascript on daily basis. However, I totally disagree that those computing concepts should be taught in an intro class, when the student not only has to struggle with learning basic computing concepts, but also with memory management and low level quirks that even competent established developers struggle with sometimes.

Tl;dr: agreed that low level computing fundamentals are helpful to every developer, disagreed that intro classes are the right place for them.

The reason is that not teaching those lower-level concepts continues to allow them to be magical. No one expects to get into Reference Counting vs. Tracing Garbage Collectors, but understanding that lower-level construct exists partially removes the mystery of the underlying mechanics. An analogous example would be Cars: you press the accelerator and gas gets sucked in from the gas tank to the engine. Most people don't care to understand if it is EFI or Carburetor.
My point was that even though those things are very useful to know, I don't think that an intro class is a good place for that. Your reply didn't address that at all, and instead brought an analogy that works within the frame of my argument as well.
Did you read your own quote? These aren't developers, they're "non-computer science students" who don't need to know underlying memory details, but they're being required to because this class is a prerequisite for a bunch of computing-related classes in other majors.
And how does a CS student vs an EE student know how computers "work". CS as I understand it is just the math not the underlying technology.
For some schools, including all schools in the UC system, CS majors have to take EE classes as part of their requirements. I remember having to setup and program gates and the sort on FPGA boards.
Yes, there was a healthy dose of facetiousness in my comment ;-)

That said, there is definitely something to be said for learning a lower-level language fairly early on I think. It's much easier to go from worrying about pointers vs values, manual memory management etc to not having to think about them than it is the other way round.

It's an _introductory_ course for a reason. Not all of these students are going to be developers. Those that do, will take advanced classes, rather than trying to interview on the basis of an introductory course.
Do other fields create their intro courses with the plan that people won't take any other classes and therefore not create a curricula that builds to more complex things?
To be fair, there's always a dividing line. Usually, "knowing how a computer works" for a programmer is equivalent to knowing the programmer's model for a cpu. A programmer's model is most definitely not how a computer really works (cf. recent cpu security flaws with speculative execution), but it's usually good enough.

Knowing more and deeper information is usually a good thing, but students don't need to learn it all at an introductory level which I think this article is focusing on.

No one is suggesting that CS students shouldn't learn about low-level machine architecture - what would they do for the last 3 years? C++ is just not made to be a first programming language.

Aside: I'm not convinced that Python is a perfect first language either - its error messages are very unhelpful when you're learning. Also I think a "NAND to Tetris"-style curriculum could work, but C++ would still not be the first step for this.

Also, look at the second half of that sentence. This is not about "developers". If you're a business or physics student who's taking one elective programming course over a bachelor's degree would you be better served if that one course was in Python? Yes, absolutely.

I think there is something to be said for Scheme as an intro language. Knowing the "full stack" of computation doesn't need to end at NAND gates, it could just as easily end at the lambda calculus. In fact, I personally would prefer it that way.
I'd be really curious to see a study of the performance of CS majors in later classes by paradigm of the language taught in CS1 (i.e. imperative/OOP vs functional). I've been trying to keep my eye out for a while, but haven't really found anything that answers this specifically.
Maybe course withdrawal rates could be used, but getting access to the necessary statistics seems like it'd be a chore. I just checked with my university and the only statistics I can find are centered around graduation rates. One would likely have to contact all the registrars among a sample of universities individually, as I haven't found a university offering these statistics yet.
CS Educators do this research all the time, but it's pretty challenging to design a CS1 class that's effective but also so radically different from the typical paradigm.

There's also a risk you'll set students back if it's not effective so there are definitely ethical concerns and it requires interrupting a professor's load for the quarter. That said, CS educators conduct research like this all the time and there's probably a lot of value in studying this kind of change.

What's so bad about using C++ as a first language? My college uses C++, and I'm very happy that they did so. Transitioning into higher-level languages is very easy, and at no point while I was learning the language did I think "Damn, I wish we used Java/Python". I really have no complains.
C++ has all this "language-specific" overhead that you kind of have to wade through before you can get to doing anything really productive. Python is easy to use and be productive with out of the box, has a complete feature set, doesn't require manual memory management and has far more expressive errors.

It really depends on the emphasis of an intro programming course. If the goal is to cover the basic control structures of a higher level language (conditionals, loops, switch statements, functions) and the fundamentals of object oriented programming, and get into some basic algorithms and data structures, then Python probably has less baggage and is more terse and expressive than something like C++.

It almost feels as if more universities should have two different "introductory" CS courses: one for non-majors, and another for majors. I would however express that in my CS curriculum (only 6 years ago) we did not start using C++ until my junior/senior year, and instead stuck with Java.
I'm not sure about segmenting intro courses by majors, but there is good research that suggests that segmenting CS1 by level of background knowledge has a significant positive impact on future coursework [0]. I suspect that a larger proportion of students who eventually study CS have a higher degree of background knowledge as well, so this probably makes sense.

[0] https://dl.acm.org/citation.cfm?id=2445248, https://dl.acm.org/citation.cfm?id=2255982

>C++ has all this "language-specific" overhead that you kind of have to wade through before you can get to doing anything really productive.

For that reason I'm surprised by the lack of enthusiasm for just starting students in C.

By university, I imagine most students have already spent some time noodling around enough to understand some basic paradigms. C does not have the barrier that C++ has in that way. It's so much smaller, which is great, and no less useful. Soon after learning the basics a student may want to jump to something else, but then they'd be fully equipped.

Not that I'm against the Python approach— but for somebody looking for a deeper understanding C seems like a good choice since you can either drill down into memory management, or (as long as you don't do anything drastic) be somewhat lazy about it (with modern computers).

Python— I agree with many people in the thread—is very suitable for non-majors or a more applied approach. I am consistently trying to encourage non-programmer friends, family, others to take a stab at it because of the increase in productivity or ability it gives them with their machine they use on a daily basis.

... To the other questions— how much do you really need to know to be considered a CS? Surely you could pare it down to theoretical physics if you wanted to and eventually end at some unanswered questions somewhere between electron behaviour and quantum physics, no? Then you're a computer scientist.

Kidding aside and perhaps off topic—but much of the discussion in this thread causes me to wonder why so many interviews surround the ability to re-implement common (stdlib) algorithms, or on the web-side polyfills for existing language features, rather than understand some basics about how memory works from a programming perspective.

You have a great standard library; you don't need manual memory management, because this is an introductory course; the error messages are admittedly bad, but not that terrible if you are not using templates. I'm not particularly fond of C++, but if you intend to teach the basics of programming and data structures, it's a decent language.
We definitely need more developers who can't leverage more than 10% of the CPU's actual power.</sarcasm>

Its literally impossible to have any clue about performance without understanding the hardware. Sure you can profile and gain 5-10% after micro-optimizing what the profiler tells you.

But you will never, ever get the 200-1000% performance gains you can only get by accounting for the hardware at the very architecture level, something you can't fix by just profiling later on.

What even is the point of having programming classes if alls they do is teach what you can learn yourself with an online tutorial?

I don't see what any of this has to do with C++, especially modern C++.

The only "low-level" detail from lower level systems course I find that is still relevant on a daily basis is cache-alignment - which I doubt they would cover in a 101 course anyways. Almost everything else either 1. the compiler does better or 2. you'd have to know how to fight the compiler to achieve.

Anything that would let you achieve 200-1000% performance gains in Python vs C++ (besides, again cache alignment) is likely not something you would cover in a intro level course. (I know C++ is faster Python, but that has nothing to do with "accounting for the hardware at the very architecture level")

SIMD. As you say, "you have to fight (or escape to assembly) the compiler to achieve" SIMD, even in C++. But in C++, you can correctly align the memory in preparation. In Python? Not so much.
>What even is the point of having programming classes if alls they do is teach what you can learn yourself with an online tutorial?

Well, you can learn everything covered by even the most exhaustive CS degree by yourself using open resources. Low level knowledge is not locked away in some ivory tower. You certainly don't have to join a modern priesthood to gain access to high quality learning material, no matter how much the priests tell you otherwise :)

>You certainly don't have to join a modern priesthood to gain access to high quality learning material, no matter how much the priests tell you otherwise

I've been reading that book, too, and agree with the sentiment

I think the path python/javascript => java/c# => c/c++ makes more sense. But students should finish with c, not start with c. And the performance you get out of java or c# is not that far behind c/c++ performance.
But you aren't getting details of the hardware at the very architectural level as they exist today even with c. Even with asm. You are getting the details of an abstract model of a computer that is long, long since gone if it ever fully existed in the first place.
99.99% of programmers will never need a machine level understanding of the programming language and architecture they use.

Really the only people I see might be machine level understand are 3D engine developers and high speed stock traders. VERY few other people need to understand how you need to organize your collections so that they are brought over in the correct page size from the L3 to L2 cache.

From what I have seen many programmers have no clue as to when to optimize something. They want to optimize everything which is a huge waste of time.

As for programming classes, they are pointless in modern society but most(ALL?) companies still like to see that you have jumped through the hoops correctly. And that you can be trained correctly to "Be a good team member".

C++ should be an advanced class, not an introductory class. That's the best way to put off someone from programming otherwise.
Yeah, the world really needs a load more gatekeeping jerks who don't consider Python a "real" programming language.
You fail to justify why C++ conveys an idea of "how computers work" better than assembly, or machine code, or learning the basics of transistors, capacitors, signals etc. Why does C++ have the "right amount" of abstraction, when it sweeps under the rug a vast body of physics and EE?
> better than assembly, or machine code,

I was studying assembly in the second year. What is the problem? It was really easy because in my early years I was writing 64k demos.

> or learning the basics of transistors, capacitors, signals etc.

It's the simplest part of all computer architecture. I think I can explain what is D flip-flop/transistors in one hour.

> Why does C++ have the "right amount" of abstraction, when it sweeps under the rug a vast body of physics and EE?

C++ has OOP, has a smart and raw pointers, STL(not the best, but better than C). Right now I'm working on a project where I need process more than 50Gb in 10 minutes. Python script uses 110Gb of RAM because there are no pointers. I don't know why the previous developer chose Python for this tool.

While the best programmers definitely have that knowledge, most programming jobs don't require that anymore. It's like saying that in order to be a secretary you need to know how to replace a typewriter ribbon.

Most applications aren't written on the machine level, nor do they have the complexity that requires machine level knowledge. Embedded systems programming is, at this point, a separate disciple than generic software engineering.

The only regular exception I see to this is the poor curriculum around most Java oriented BS programs. I've seen many candidates come from a Java focused school that couldn't even write their own code without a full hand-holding IDE.

Computer courses are no different than any other course. What's the first semester requirement for math? You can graduate high school without taking advanced mathematics, it doesn't mean you're prepared for college-level math in the CS field.

Similarly, most high schools offer introductory programming courses. I would expect almost every CS major to have taken these classes prior to being admitted to the major.

If you didn't take those courses in high school, there are avenues to acquire that knowledge before taking the CS required courses.

When I was in high school C++ was taught as an intermediate language to sophomores. Most everyone in the class had no issues learning the language. We were all making our own versions of frogger in the terminal.

There was plenty of focus on problem solving and developing interesting programs. The language didn't get in the way at all.

One thing we had that seems lost today is the nice, simple programming environment with Borland Turbo C++. These days I suppose people use Visual Studio but can kids really go home and get up and running quickly? Embarcadero exists but the license is prohibitive. Perhaps if there was some way to get them working in a unix environment--which is what they'll end up in anyway--but teachers would be right to balk at the idea of teaching a new OS...

C++ was a much simpler language back in the Turbo C++ days (early 1990s). If I recall, there were no namespaces, exceptions, or templates (and no STL). It was much easier to get started with back then.
I graduated recently and we were taught C first and then C++ of OO concepts. I don't think anybody had issues learning OO concepts this way though most of what we learnt went out of the window when we started learning Data Structures and Algorithms in Java. It seemed a lot easier and a lot more could get done in the same amount of time spent on C/C++.

But I still had a fascination with C. I tried to do a few networking projects using C which turned out to be more tiring than expected thus abandoning the whole project. I think if we would have stuck with C/C++ all the way through the Algorithm's class it would have been much more helpful. Java/Python is way too easy to pickup later on your own and reproduce the same results that one would in C/C++.

I really like Lisp-based and multi-paradigm languages for teaching because you both want to span as much of CS as possible in a single language, and you eventually want to implement languages and compilers as part of the curriculum. The former requires multi-paradigm, the latter requires good metaprogramming and homoiconicity. You also want the ability to get low-level to talk about the assembly code (or LLVM IR), function pointers, and handling of memory allocations.

Python is good in the multi-paradigm sense but it abstracts too much away. C++ gets in the way of learning the higher level concepts. Scheme is great for teaching but not really used. I think Julia sits comfy in the middle and can be a great teaching language once its tooling evolves more. It's the only language I know of where some people are writing lazy functional code with metaprogramming, others are writing high-level scripting language vectorized code, while others are writing inline LLVM and controlling stack vs heap allocations, and it all makes sense. I wouldn't use it in a first programmer's course quite yet because the books and tooling need a little bit more, but in a few years I see it as a great option for a university to choose than can span multiple courses, from beginning programming all the way to the algorithms courses and HPC.

>you both want to span as much of CS as possible in a single language

Why? Teaching different languages for different kind of requirements make much more sense.

That would end up being too much to cover during the course.

Time spent getting a class to learn new syntax is unnecessary and takes a long time.

Learning syntax is not really that difficult.

On the other hand, a new language (ideally) teaches you a new way to think about problems. If you have a concrete problem to focus on, that part becomes much easier and intuitive.

No, it's not.

Keeping an entire class on the same page is.

Introducing a new side-topic would be detrimental to traditional lecture-based courses.

...not that they are a particularly good method in the first place.

Sounds like http://terralang.org would be your ideal learning language.

It starts with Lua(Jit) -which is a very simple, powerful, Schemy language. Lua is used both as a runtime and as a metaprogramming layer for a Lua-ish interface to LLVM IR (including SIMD) that requires static typing and manual memory management. It is intended to be the implementation layer of compilers and JITs and it is created by and for the HPC community.

All it really needs is more attention, documentation and tutorials.

In my opinion C++ and C are rather good choices for a first language. There is significantly less 'magic' going on behind the scenes and the language design choices generally have sane explanations.

For example, the standard library does not have access to language features hidden from users.

I beleive UCI switched to using Python for most CS courses. Previously they were using Java and I’m sure C++ prior to that.
Whoa... (UCLA c/o 2010, Bioengineering) UCLA used to use C# in the PIC10A series. I didn't take too many classes in these series, but did audit some while I was deciding as a non-CS major how technical to become. Personally, I think it's fine for the Math Department to use Python - there's plenty of opportunities to do the lower level stuff or unmanaged stuff in other classes at UCLA.

For CS/CSE and engineering majors we take the CS31 (intro to CS)/32 (data structures and algorithms)/33 (operating systems) series - these primarily use C++ (if not C, assembly, etc.)

I don't know if I should feel good about this. I graduated from UMich back in 2015, and we tend to do a lot of the core CS courses in C++. After working full time for ~2 years, learning to code on a lower level helped me understand computers better and write better code.

There are kids around my age group who don't do as much C/C++ and dislike it because of the "pointer" concepts. They find them hard, but these guys also don't know other CS concepts like how a GC works or pass by value vs. pass by reference.

Our professors have good reasoning for why the school does this: "By teaching you everything in C++ first, you'll find it much easier to pick up any other programming language".

Pointers aren't the bad thing about C++.

Syntax, templates, etc. are. C++ is a mess, and there are plenty of better alternatives.

Python is probably as effective as C++ for preparing students for more challenging CS classes in other languages [0]

[0] https://dl.acm.org/citation.cfm?id=1734437

Thanks a lot for this reference. Do you happen to know of any other research in this area? I'm looking for academic work on the topic myself and not finding as much as I'd hoped for.
I think pascal gets you the best of both worlds.
I hate python. It's an awful language and should be burned with fire. And yet its my go-to language when I just need to handle some small problem. It's so bad, and I use it anyway because it gets the job done. I never use C++ any more. (well, I used C once last year to create a brute force DNA search algorithm that was 30x faster than our previous implementation, but that kinda proves my point). fuck, i learned to program in BASIC.

I was gonna say "maybe Node", but there are a lot of python libraries that benefit academics.

But it sounds like the course we're talking about here is for actual CS majors, in which case, UCLA, are you fucking mental? Python?

I think the issue here, though, is that C++ is fucking garbage now. It's utterly horrible to use, bloated in all the wrong places while utterly non-existent in places that would make day-to-day use of the language viable. Last year I used C (not C++) to get the job done. You'd have to be insane to build a large scale product in C++, and in the places you really need performance, C or assembly is better.

I think UCLA is correct to drop C++. But teach C instead, not python.

A CS education, for better or worse (in my opinion - for the better), is grounded in theory and foundational knowledge. Introductory CS classes are designed to ease people into programming, yes, but also to give a taste for concepts that they'll eventually have to become very comfortable with later on.

I don't think Python is a bad first language to learn, but I think that it's important to consider the audience of these introductory CS classes. These classes aren't really designed JUST to teach you programming (I say this as a person who never coded before CS31). This is why the UCLA Computer Science faculty recently introduced CS97, which is actually an introductory programming course taught in Python for absolute beginners. That way those who are already comfortable with coding can ease themselves into learning about lower-level implementation they may not have been exposed to before, and absolute beginners can supplement their introductory _Computer Science_ class with an introductory programing class as well.

I majored in EE at UT Austin around 2000, and our intro programming class was C++. I doubt there was a good rationale for it other than to cause rapid attrition of EE majors. I never again used C++ in my studies or professionally. Learning C would have been much more helpful for my later embedded systems classes.
I think I agree with this article (even if some of its argument is bogus). The other thing that all programming classes should teach, regardless of whether they're for CS majors or not is how to debug using a modern (i.e. not command-line-based) debugger. It's insane that programming is being taught anywhere without teaching debugging at all, or teaching only very hard-to-use debuggers.
What UCLA is doing, as well as most universities is the difference between a university and a trade school. these courses do, and should focus on the fundamentals. University is teaching the theory, and having a fundamental understanding. Otherwise there are ample trade schools and code camps, that will skip the fundamentals, and teach you the basics of programming tailored to the current job markets needs.

As for the argument that C++ isn't good learning language, I beg to differ, it gets you very close to the meat of how programming works, without the layers of abstraction that higher languages offer. C++ requires that you understand memory, its allocation, and allows you easily to see how it interacts.

Can't wait for the driving lessons in a self-driving car