Why Teach Python?
There are hundreds of programming languages out there, that do all sorts of things. Why do we teach Python on Grok? What about other languages? Well, there are a couple of reasons. Let’s start at the beginning, with “Hello, World!”
“Hello, World!” is the traditional first program you write in any language; it’s a small program to print the text “Hello, World!” Let’s see how it looks in a few languages.
These are the three languages that I was taught in the first two years of university. All of these courses assumed that it was your first time programming, and had a “Hello, World!” task in the first tutorial. What the C tutor and the Java tutor both said at times was “Don’t worry about that bit for now.” I’ve coloured the stuff they told me not to worry about red.
Wow, that’s a lot of red! That’s just stuff that students are being asked to accept as magic for now.
Now, I was lucky; I already knew how to program, and I was able to push past that. I had a much easier time learning the languages, and what those magic bits did. But I saw other students around me get disheartened. They couldn’t even understand the first program, so what hope did they have of passing the course?
In comparison, the Python example is all relevant. There’s none of this
public static void main or
#include <stdio.h> magic. It says what it does, plain and simple. So this brings me to my first tenet of a good teaching language:
1. No magic
Let’s look at two other languages I was taught, Visual Basic and MatLab. One I learned in high school (VB), the other in uni (MatLab). These two languages both have very specific purposes. Visual Basic makes Windows applications with a graphical interface. MatLab does maths programmatically.
Both are interesting, for sure, and I learned from doing them. But I never knew what I would be using them for. I wasn’t going to be a mathematician. And I mostly used Macs, so why would I use something that only works on Windows?
By comparison, Python works everywhere. You can run Python on pretty much any machine. On an Apple computer, and most Linux distributions you have Python right out of the box. There’s even a bunch of web editors like Repl.it or our own platform, so you can use it however you want, wherever you want to.
It can also make almost anything. It won’t always be the easiest thing, and but you can do anything with it. So now we have tenet two:
2. It should be general purpose
Python has one other advantage up its sleeve, one that might not be obvious at first glance. But first let’s talk about another language.
The very first language I learned was Runtime Revolution, now called LiveCode, when I was about 11 years old. I learned it because my mum used it at the time, as a freelance developer. Here’s a look at “Hello World” in it.
Well hey, that looks great.
put is an odd choice of word, but it’s not too wild. It’s certainly easier than Java or C.
It’s also a general purpose language. It also does graphical interfaces easily like Visual Basic does, but it’s cross platform. So why do we teach Python instead of LiveCode on Grok?
The simple answer is because Python is popular.
If I do a Google search for “Python tutorial” I get over 300 million results. LiveCode gets only a little over 150 thousand. And then I had to do a bunch of digging, half a dozen clicks, to find a tutorial. And then it was a couple of pages before I wrote some code.
So here’s the third and final tenet:
3. Popular enough to have support
I feel like I should point out that my mum did great, and Runtime Revolution was perfect for me as a first programming language. I had an expert right there, and I didn’t care about consoles or anything. If I couldn’t make a GUI in 15 minutes I wasn’t going to enjoy it. Thanks Mum!
So, let’s address the elephant in the room here:
All these languages are for making programs that work on your computer. You run them, they do a task, and then they finish. But the internet is exciting, and these languages don’t help you with websites, web apps, and interesting and things to do there!
This is a whole different question, it turns out. It’s definitely worth learning about web development, but it’s best thought of as a separate field when starting out.
Get in touch and let us know if you agree, or if you have other ideas for what makes a good language for teaching with. What languages do you use?