Seven Features an Introductory Programming Language Should Have

Python Logo

Python has recently supplanted Java as the most popular introductory teaching language at top U.S. universities. There are many articles covering this fact from the perspectives of computer science faculty at major universities. I wanted to take a moment to add my own thoughts on the subject.

There are several key features of Python that make it more suitable as an introductory language compared to Java:

  1. A more gradual learning curve

  2. Object-oriented programming is not required

  3. Designed for readability

  4. Less verbosity and boilerplate

  5. An interactive shell for exploratory development

I'd like to tease out each of these points. While both languages can be used to write large and complicated programs, the path from an empty directory to a simple and working program is much more straightforward in Python.

Programmers with little experience can use Python to do simple tasks such as web scraping within a few days or weeks of using the language. There are advanced concepts to learn, but the learning curve is more gradual because more can be accomplished in Python with only simpler, more foundational concepts such as variables and control flow.

Courses that use Java as the teaching language focus heavily on object-oriented programming (or "OOP"). While Python is also object-oriented, it is a multi-paradigm language that can also be used with the functional or structured programming paradigms. While it is important to learn OOP eventually, many learners catch on more quickly to the more concrete structured programming paradigm. It is my view that learning about OOP in the level of detail needed to write a Java program, before completing several small programs that work, is a pedagogical mistake that fundamentally puts these steps out of sequence. i.e. A learner should first write small programs before approaching the techniques and concepts used for writing larger ones well.

Furthermore, Python was designed with readability in mind, and is known for mimicing pseudo-code more closely than other programming languages. Learning the keywords and syntax needed for Java programming obfuscates the overall goal of an introductory course; to teach fundamental programming concepts that surpass a given language or problem domain and enable the learner to obtain key insights that will continue to serve them as they learn more computer science and software engineering concepts.

Lastly, like many other languages, Python features an interactive shell that allows the programmer to try small bits of code at a time and to explore the program being developed from within. This shortens the feedback loop of trying out new ideas compared to having separate compile and run steps. The advantages of an iterative approach with a quick feedback loop for a beginner should be obvious.

With all of this in mind, I find it hard to imagine how Java ever became a common introductory language at all. Explanations for this usually center around the importance of object-oriented programming and the ubiquity of Java in the industry. While these are both good reasons to learn Java, possibly even as a second language, they are far from convincing for the purpose of introducing programming.

I would argue that the features of an introductory programming language are:

  1. A shallow learning curve

  2. A clear and consistent language design

  3. Many libraries available for a variety of needs

  4. An interactive environment such as a shell

  5. Light on clutter, boilerplate or superfluous details

  6. An obvious path toward creating small and simple programs

  7. A rapid rate of development

I've outlined how Python meets most of these points already. On the point regarding libraries, in this regard I think Java and Python both feature a rich ecosystem for beginners and experienced programmers alike. However, considering all of these points, I think a number of languages are more appropriate as an introductory teaching language than Java, including at least the following:

  1. JavaScript

  2. Ruby

  3. Scheme

This brings to mind a much more interesting and difficult question. What makes Python a more appropriate first language than each of these? I'll leave this to a future blog post because I think it needs careful and long form comparisons.

I hope to have made clear why I'm glad that major universities are making the shift to Python for introductory courses. In the future, I hope to broaden this argument and describe how Python is the best first language to learn.

Headshot of Caleb Smith

Caleb Smith wrote this
on Mar 01, 2015.