Tuesday, April 24

Mariah Furtek: UCLA introductory programming classes should focus more on Python, not C++

UCLA should incorporate the Python program to introductory computer science courses to make computer programming more accessible to students. (Kristie-Valerie Hoang/Assistant Photo editor)

UCLA should incorporate the Python program to introductory computer science courses to make computer programming more accessible to students. (Kristie-Valerie Hoang/Assistant Photo editor)

Imagine if UCLA offered a course in building doghouses. With only 10 weeks, you would expect the class to teach students the basics needed to produce a final product – maybe focusing on how to sketch a blueprint, buy materials at Home Depot and hit hammer to nail.

You wouldn’t expect UCLA to start students in the forest with a theoretical discussion about how best to select and cut wood. There’s no need to go that in-depth on something so peripheral to the course objective.

But this is what UCLA’s mathematics department is doing in its backward approach to teaching students how to code.

UCLA students interested in programming end up taking introductory computer science classes such as Program in Computing 10A: “Introduction to Programming,” a course that teaches basic programming principles using the computer programming language C++. C++ is widely considered the most fundamental of programming languages and requires students to learn about how computers store data and interpret code in order to create functional programs.

There is a simpler programming language, however, known as Python, that many other universities have found to be a more accessible first programming language for students. Python conceals the underlying, nitty-gritty complexities of C++, still allowing students to learn how to solve everyday problems using computers.

UCLA should allow South Campus students to satisfy their computer science course requirement with a course in Python instead of C++ to make computer programming more accessible to non-computer science majors and students not pursuing STEM.

PIC 10A satisfies the computer science prerequisite for students in the sciences, including astrophysics and applied mathematics. Electrical engineering, computer engineering and computer science transfer applicants are also required to have completed a course in C++, such as PIC 10A.

Python, however, is more accessible as a first language because it is an interpreted programming language, while C++ is a compiled language.

In compiled languages, a program is written directly for a machine, using the target machine’s own language. In interpreted languages, however, a program is translated by some other program into instructions for the target machine. In this way, programs written in Python and other interpreted languages more closely resemble English. On the other hand, C++ and other compiled languages are written in a way that more closely resembles what is going on in the computer, which looks like gibberish to the untrained eye.

This simplicity is what makes interpreted languages more accessible to beginner programmers.

“Python gives you enough of an understanding of computing basics without needing you to be an expert in memory, like in C++,” said Elena Escalas, a third-year computer science student. “This makes computer science less intimidating for non-computer science majors.”

Python is even considered a less intimidating program for computer science students. UCLA’s computer science department recently introduced a course, Computer Science 97: “Principles and Practices of Computing,” to better prepare students for introductory classes in C++.

Todd Millstein, a computer science professor who spearheaded the adoption of CS 97, said he thinks Python is an easier language for instructors to teach students basic computer science.

“Python is a lighter-weight language to start with, which makes it easier for students to tackle underlying computer programming concepts,” Millstein said.

For example, it allows students to focus more on problem-solving and developing interesting programs rather than concentrating on lower-level implementation details related to how machines interpret code – knowledge that non-computer science students are unlikely to use after they graduate.

“In the beginning, you want to focus on ideas and on algorithms,” Millstein said. “The point is to learn these ideas so you can then transfer this knowledge into different settings and different languages.”

Python is also more useful than C++ for non-computer science students. The language makes it easy to process and manipulate large sets of data, which is critical in fields such as astrophysics, where researchers work with enormous image sets collected from telescopes and satellites.

However, Chris Anderson, the director of the program in computing within the math department, said he doesn’t think Python would be an adequate introductory programming language because it doesn’t expose students to important aspects of basic programming.

But it’s worth noting that UC Berkeley, Stanford, Harvey Mudd and Boston University all start students with Python before moving on to C++.

Integrating Python course offerings more thoroughly into the computer science curriculum can also make computer science more accessible.

In 2006, for example, Harvey Mudd replaced its traditional, Java-based course with a Python-based course. As a result, the number of students who became interested in computer science increased. The university concluded that the simplicity and applicability of Python allowed students to better understand the fundamentals and relevance of computer science.

Boston University also changed its introductory computer science course in 2014 to include Python, citing the success Harvey Mudd had with the program.

UCLA needs to take notice of the academic successes of incorporating Python into computer science prerequisites and join the schools committed to getting students out of the woods and into less theoretical, more practical computer science classes.

Share on FacebookTweet about this on TwitterEmail this to someoneShare on Google+Share on Reddit

Comments are supposed to create a forum for thoughtful, respectful community discussion. Please be nice. View our full comments policy here.

  • Arthur Yip

    Related article from 2014:
    Python Is Now the Most Popular Introductory Teaching Language at Top U.S. Universities

  • Keinan Balsam

    “In compiled languages, a program is written directly for a machine, using the target machine’s own language.”

    This isn’t true, compiled languages are not written in native machine code. They are compiled into machine code or even bytecode sometimes. The rest of that paragraph is an oversimplification of the differences between interpreted and compiled languages. Compiled / interpreted are traits assigned to language implementations. Some languages have compiled AND interpreted implementations.

    • gonewest818

      Arguably, students understanding that distinction correctly is something I’d want from an introductory course, regardless which language was chosen for the assignments.

      For decades MIT taught introductory computer science concepts in the course 6.001 “Structure and Interpretation of Computer Programs” taught in the language Scheme. Even MIT has since shifted their curriculum to Python, although their reasoning was not quite what’s offered here.


  • David Allyn

    I love your argument that Python should be taught – and it is a very easy language to learn, definitely. UCLA should be teaching this language as it is a critical piece of the future!

    However, please bear in mind additional context of what UCLA really offers. UCLA is *not* teaching how to simply write a program in a language like Python (or VB, or C++, or JS) – you can learn that on Lynda.com. What UCLA is teaching is how one would *build* a programming language like Python from scratch – that requires knowing all of the things that make up that language – which does require understanding how to pick the right tree for the wood — or the right base language to use to build your new, better version of Python – the Furtek language, perhaps??

    • whomedoyou

      I think the author could have been clearer when making the points but clearly not everybody needs to know how to build the next Python to take advantage of the computation efficiency provided by knowing how to code in at least one programming language.

      You don’t need to know C++ if you’re only ever going to make functions or routines to compute mathematical outcomes and/or string processing etc. in your career.

      UCLA could have also a Python based course (along with computing basics that are required irrespective of language used) but you shouldn’t be required to do it in C++ in this day and age. Advisors can help students decide what they should take – after all that role already exists at Universities. C++ is not redundant in any shape or manner – but perhaps lets have people do these courses when they’re needed (Computer Science, Computer Programming, etc).

  • Ignacio Zendejas

    I wholeheartedly agree with this article and I’ve long criticized my alma mater for this very reason. Non-CS majors have no business learning C++. In fact, Python is a much better language not just because it requires a smaller learning curve to use, but because it has fantastic computational and machine learning libraries (eg, numpy, scipy, scikit-learn and most recently, TensorFlow). Non-CS majors don’t need to understand how memory is allocated, for example, to solve very challenging problems using libraries like the aforementioned ones. That doesn’t mean they shouldn’t get opportunities to learn those concepts–they just don’t have to.

    As a former student who went through the CS program, I was very disillusioned until I got to upper division courses which did a better job of teaching me some tools to solve complex problems. It was very clear to us from the beginning that the 30-series courses were designed to “weed” students out. It was more a challenge in survival than a joy to participate in the art of programming and building cool things. My undergraduate classes had on average 2 female students. I firmly believe this would have been very different had we not had a backwards attitude towards learning. This whole weed out thing is a very macho mindset that just doesn’t make it appealing for women to partake in.

    After graduating and learning more about the software industry and the startup world, I’ve since come to realize the departments in question have also contributed to the very low number of female and minorities in tech because of this “weeder” mentality–just think about how wrong that is. The truth is, unless you were exposed to programming very early on in the 80s or 90s, learning C++ is an unnecessary ordeal as an introductory course. C++ is better left off for specialized courses and tracks (think low-level “systemsy” like operating systems/embedded systems). There’s still a need for these types of engineers, but the markets have moved on quite significantly over the last two decades.

    Hence, UCLA needs to modernize it curricula and prepare students for careers in software engineering at the most competitive companies (which rarely if at all use C++–hell, Facebook uses PHP (Hack) in their primary codebase). I argue that by making their courses more accessible, they’ll also encourage more entrepreneurs to come out of those programs. This will benefit the UCLA community and the world immensely. As someone who has just co-founded a startup, I kind of regret not applying to Stanford. That’s where many entrepreneurial students apply. UCLA doesn’t have to completely emulate such programs, but they can certainly learn a lot.

    Does a physics, math or other science major need to know how linked lists (I had to implement these in CS 31!) or other data structured work? Nope! Memory and computation has become incredibly cheap and these are unnecessary tools–not when you can just use a hashtable (eg, hashmap or dicts). Not once have I had to use any of those data structures after that course. Instead of making students implement said useless data structures, help them learn how use cool libraries and solve problems they can relate to or are motivated to solve. When they realize there’s not much to it and can think in more abstract terms about real, tangible challenges they or their communities face, you’ll be surprised how much more enthused students will grow.

  • 琴の火鉢

    Python as an introductory course/language makes sense. C/C++ should be saved for an advanced course for continuing C-Sci students and for sub-courses in IoT programming.

  • dhananjay agrawal

    Become Python Expert By simpliv for $12 with lifetime access.
    for more info – http://www.simpliv.com