Python vs. Java: Udacity Instructor Weighs In On Programming Languages

Python, a programming language named not after a snake species but a 1970s British television comedy sketch, is gaining popularity in colleges across the US. In a recent article, ComputerWorld reported that  “Python has surpassed Java as the top language used to introduce U.S. students to programming.” The article goes on to suggest that majority of top computer science departments in the US now use Python to teach coding.

As a teacher who has introduced programming to thousands of students, I must say that I am thrilled with this development. Consider the following program in Java. It prints out the text “Hello World” on the screen and is generally the first example used by many programming instructors.

Hello World In Java

class HelloWorld {
   public static void main(String[] args) {
       System.out.println("Hello World");

Now imagine you are a novice programmer looking at this program. You would probably have many questions, including: What is a class? What does the word public mean? What is static? What is main? Why does learning have to be so tough?

One way I have seen many teachers handle this barrage of questions is by telling the student to simply “trust them.” This response, as I suspect you will agree, is just not satisfactory.

Next, let’s look at the same program in python.

Hello World In Python

print “Hello World”

It’s one line of code and is pretty close to English. This lets the learner focus more on the program they are designing and not get riled up in tricky syntax and keywords.

In one of our new courses, Programming Foundations with Python, we leverage the simplicity of Python to teach important computing ideas like Object Oriented Programming. In Intro to Computer Science, Udacity’s most popular introductory programming course, we also introduce students to programming with Python. Thousands of students have taken these courses and are responding positively to Python.


Miguel, a student in Programming Foundations with Python, posts his feelings on the discussion forum by saying, “I’m quite impressed with how easy it’s been to utilize Python for interesting tasks.” Christine, another student in the class, says that she, “explained to [her] husband how [her] program works … and he was impressed that python can achieve such results with so few lines.”

As a teacher, I welcome the use of Python in introductory classes. But I am also convinced that Python will eventually be replaced with a new language of choice — in much the same way that Python replaced Java, which previously replaced Pascal. I tell my students that the one thing they can be sure of is that they will be learning new programming languages throughout their career.

This brings to fore the idea that we all really need to learn how to learn new things. This sounds like it could be a new course at Udacity. Who’s with me?
Kunal Chawla, Instructor, Programming Foundations with Python

Kunal Chawla

Kunal builds online courses at Udacity that teach students how to program.His recent course on object-oriented programming was featured on the cover of the New York Times Technology section and he has been interviewed by Class Central and others about the future of MOOCs, online courses, and computer science education.

11 thoughts on “Python vs. Java: Udacity Instructor Weighs In On Programming Languages

  1. 2015 is coming and it would have been better to compare with Scala.

    I don't think printing a string in Scala is too intimidating as it is just println("Hello world").

    In my opinion, this new language in JVM can lower the barrier for beginners and would continue to reward by the ecosystem, type safety, functional programming, …

  2. It depends on what you want to do later on. If you're only going to be a casual programmer as an adjunct to some other career then Python is fine. If you plan to get into Computer Science as a major, learning to program in C or C++ is more frustrating at first but will force you to learn things that will make life easier later on.

  3. The article has flaws.

    First, to my knowledge, Java has not been the most used language used to introduce students to programming. When I was taking my Computer Science Bachelor degree, I never studied Java, it was C and C++. I had friends from other unis, and some even never heard about Java.

    Second, the article insinuates that Python is a newer language (i.e. better constructed, etc.) which is actually not the case. Python, Java, and even Ruby (which many assume a newer language as well) were introduced about the same time (you can verify this fact on wikipedia)

    The fact that Java becomes one of the most popular languages has not been due to the claimed that it was the oldest language, it is simply because it has been the most used language in corporate world (and again “not academic”) because it has a clear structure which often looks tedious and “restricted” but is important if you want to build a complex enterprise application.

    If you want to build a sophisticated and “perhaps” faster isolated application, one can argue that Python (or Ruby or even Javascript) can replace Java but until proven that either language can be used in enterprise where you have millions of line of code, multitudes of programmer with different styles and aptitudes and where there is a lot more factors to consider than speed and shorter syntax then until present Java is still the go to language in enterprise which leads to the general supposition that it is also the most popular language in the academic.

  4. Python and JAVA both emerged pretty much the same time in early 90's. Python has not really replaced JAVA but has certainly got momentum in popularity owing to its widespread use in emerging field of data science.

  5. As a programmer in the professional world for the past 15 years and a computer science student before that I can clearly say that this type of comparison is pointless when you are comparing a dynamically typed languages to a statically typed languages. People do this all the time without realizing that these languages were designed for different purposes. Dynamically typed languages were never designed for large-scale use no matter what your college professor wants you to believe. Tooling and help from the compiler is much better in statically typed languages. The propensity to introduce bugs in statically typed languages is much less because the compiler has a better understanding of the data types in your code. Don’t get me wrong, python is a cool language but it’s been around a long time and would have taken over by now if it was the great panacea college professors like to make it out to be. Besides, looking at code without braces after a while becomes irritating at best. Python introduces nothing new then any other language. College courses is one thing, but for large scale professional development I do not recommend dynamically typed languages. My two cents.

  6. while I agree that Java is too verbose and too "enterprise" (I mean with a vast standard library with a complex hierarchy to be learned even for the most basic tasks and with even more complex extensions) to be taught in an introductory course (and probably python too if your students are engineers because it's too high level and doesn't let you learn how a computer actually works), it is absurd to say that Python is or has or will replace Java, specially considering it was first released 4 years before Java and they both are more than 20 years old which in computer science is as ancient as it gets.

  7. Java always sucked, but Sun Microsystems did an incredible job of hyping the language before it was released in the 1990s. In addition, the prospect of "write once, run everywhere" was very appealing to industry IT departments. As a result, Java become the world's most used programming language, even though it's awkward, unintuitive, and slow. I'm delighted that people are beginning to realize there are often better alternatives.

  8. There is no way you can just hype something into becoming an industry standard for more than 20 years if it's not good enough.

    Java is a standard because it's developed and released following the most strict engineering principles.

    There is a clear separation between specification and implementation, and every standard and spec is reviewed thoroughly by a committee of experts appointed by the lead industry manufacturers and goes through a number of draft releases before a solid specification is produced and released to the public.

    Again, I am not saying Python is bad. It's just not a replacement for Java!

  9. The article focuses not on the best programming language (as most commentators seem to have understood) but on the most useful for teaching coding and its principles. The comparison between Java and Python is done for this pedagogical purpose. From that perspective, although brief, the article is informative and substantial.

  10. I will try the below in my course.
    Q to student: – Where starts (is the) program?

    class HelloWorld {
    public static void main(String[] args) { // The IDE will also fold this
    new HelloWorld().program();

    void program(){



Comments are closed.