A Programming Language For Teaching

I follow a number of programmers on GitHub and Twitter, the only two social web services I use regularly. One of those programmers is Justin Tallant, a young man with obvious talent in web development. Today he announced a mentoring program to help pair together programming students and teachers.

That all made me think about a hotly debated question in the programming field: What is the best first language to teach a student? I will not pretend to provide an objective answer; I do not believe one exists. But today I will briefly discuss my personal answer.


I commonly recommend Python to new programmers in training. For starters, Python is easy to install on all platforms. The same can be said for many programming languages though, so Python is not unique in this regard. But I believe the faster a student can go from tools to writing code with results, the better.

For instant feedback on code there is perhaps no language better than Lisp; Peter Seibel has a terrific book on Common Lisp that is worth reading. But I refrain from suggesting Lisp to most people on the basis that functional programming is not as useful to beginning programmers compared to imperative programming and object-oriented programming (OOP). Python supports all three of these paradigms but focuses the most on the last two. Important concepts in functional programming have their roots in mathematics and in my experience a lot of students do not approach computer programming with a strong background in math. So imperatively telling the computer what to do with a laundry list of instructions is an easier concept to grasp than referential transparency and other functional practices.

There are languages with stronger, more ‘in your face’ object-oriented programming designs than Python. The obvious example in the minds of many programmers is Java. However, I prefer to suggest Python over Java because Python allows the student to ease into object-oriented programming. Java, conversely, forces the student to face OOP immediately. Consider a Hello World program in Java:

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

A student confronting this most basic of programs instantly faces a number of questions:

  1. What are classes?

  2. Why do I have to create a class?

  3. What is static and public?

  4. What is System.out?

It raises many questions to do something as simple as printing a line of output. The same program is more straight-forward in Python:

print("Hello World!")

That is close to self-explanatory.

Python comes with a great standard library, as does Java, to be fair. The packages that come with Python allow students to create useful, non-trivial applications without requiring a mastery of the core language. Interacting with databases, connecting to websites, manipulating audio files—all straight-forward functionality that is available out of the box. I believe it is important for students to see real results as early as possible; and by ‘real’ I mean programs which do more than simply print messages to a console.

Further Reading

If you would like to learn Python then I suggest the free online book, Learn Python the Hard Way. It serves as both a solid introduction to basic programming concepts and the Python language itself. And if you feel there are any other pros and cons to teaching Python as a first programming language then please post a comment, as I would love to hear feedback, not only about Python but about other languages that you may feel are better suited for beginners.


Add Your Thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s