skip to main content

A guide to programming languages for coding in class

Long reads
Authors: James Curran
A guide to programming languages for coding in class

So, you want to introduce coding in class but with so many programming languages out there how do you choose the one that’s right for you and your students? We asked Associate Professor James Curran, Director of the Australian Computing Academy and co-founder of Grok Learning, for help.

Since 1954, when IBM’s John Backus invented the first widely-used programming language, FORTRAN (FORmula TRANslation) for scientific and engineering calculations, many weird and wonderful programming languages have been developed for coding.

As a teacher, how do you choose which programming language is right for you and your students? Here, I’ll discuss which programming languages are suitable for each band of the Australian Curriculum: Digital Technologies and for extra-curricular computing activities.

But first, what is a programming language?

A programming language is a language for describing instructions that a computer can follow to solve a problem. Like natural languages, such as English or Mandarin, programming languages have a grammar (or syntax) that programmers must learn. Unlike humans, computers cannot understand a program if the syntax is even slightly incorrect. They will complain with a ‘syntax error’.

Compared with our brains, the CPU in a computer can only perform simple instructions, but it can do them very fast. For example, a CPU can add two whole numbers together billions of times per second, but it cannot recognise a handwritten digit. To recognising handwriting, programmers must break the task down into many simple instructions for the computer to follow.

Coding in the Australian Curriculum

The Australian Curriculum: Digital Technologies (AC:DT) mandates that all students learn to write programs from Years 3-4 through to Years 7-8, with an elective subject for Years 9-10.

In Years 3-4, students should learn to “implement simple digital solutions as visual programs with algorithms involving branching (decisions) and user input (ACTDIP011); and in Years 5-6 use iteration (repetition)” (ACTDIP020) in their programs. Put simply, students should be able to write programs that take and display information, perform calculations, make decisions, and repeat steps. In Years 7-8, students must also “implement and modify programs with user interfaces involving branching, iteration and functions in a general-purpose programming language" (ACTDIP030) and in Years 9-10 “implement modular programs, applying selected algorithms and data structures including using an object-oriented programming language” (ACTDIP041).

Nearly all popular languages provide the bolded concepts above. The curriculum makes a key distinction between visual programming (in Years 3-6), general-purpose programming (in Years 7-8), and object-oriented programming (in Years 9-10).

Let’s compare programming languages with a simple task: asking the user for their name (user input/interface), storing their name in a variable, and displaying the message “Hello”, followed by their name. These are concepts common to the programming content descriptions in AC:DT.

Visual programming

Visual programming involves dragging and dropping instruction blocks together to form a program in a graphical development environment. The advantages of visual programming are: students don’t need to learn syntax and cannot create syntax errors; students can see what blocks (instructions) are available; and, blocks often hide complex logic or operations in a single block.

Scratch and Blockly are popular visual programming languages. They have a similar style of blocks, but their functionality and environments are very different. Other visual environments include Alice and Lego Mindstorms.

While visual programming is excellent for beginners, it is too slow and cumbersome for writing substantial programs. Visual environments are usually limited in their functionality, making data analysis difficult and restricting the kinds of problems that can be solved.

Blockly (Years 3-6)

Blockly is the visual programming language used by several systems, including, Made with Code, MIT App Inventor, and our own Grok Learning. Each system uses a different set of blocks but they use similar blocks for most coding concepts, including branching and iteration. Each system runs on any modern browser, for desktop and tablets, including iPads.

The example below is from Grok Learning. In this program, the green ‘ask’ block prompts the user for their name with the message “Enter your name?” and then waits for the user to type in their name. The user’s name is then stored in the variable called ‘name’ by the grey set variable block. Finally, the purple ‘print’ block prints "Hello" followed by the name stored in the variable.

An example of Blockly coding

Depending on the system, the input and output can be text-based, graphical, or another device (such as an Android device or a BBC micro:bit). Many systems provide markers that automatically check whether the student’s code is correct.

Scratch (Years 3-6)

Scratch is a graphical environment for developing interactive games and multimedia developed at MIT. It runs on desktop or tablet browsers that can run Flash. Unfortunately, this excludes iPads. A version for younger kids (Scratch Junior), is available for iPad or Android tablets. Students can store and share their projects online.

Scratch is event based (the code runs in response to a user action, here a ‘click event’ on the green flag). Events are used in interactive programs, such as graphical user interfaces, websites and games, to respond to user input. The output changes the properties of one or more characters (sprites), such as their position, orientation and size; or background images and sound. Students find the interactive graphical programs they develop very motivating, and it appeals to a wide range and ability of students. Scratch is highly recommended as a first programming language for Years 3-4 and less experienced Years 5-6 students.

An example of Scratch coding

In the program above, Scratch’s orange cat prompts the user for the name using a speech bubble and when they enter the name, it is joined with “Hello” and then displayed for 10 seconds.

An example of Scratch coding

General-purpose programming

By general-purpose programming languages, AC:DT means a text (versus visual) programming language that can be used to solve a wide range of problems. Students should code in a language they can use to solve problems, analyse data, and enhance their learning in future study and work.

General-purpose languages include C/C++, C#, Java, Javascript, Python, Ruby, Swift, and Visual Basic. Not all of these languages are well suited to teaching at school, especially for beginners.

Ideally, we want a language with clean and simple: syntax and error messages; programming concepts and documentation; libraries for a wide range of programming tasks; and one that is available across different operating systems and devices. Each language offers trade-offs for a teaching context and/or planned projects and some languages are designed for particular tasks.

For example, C/C++ is used for low-level system development, such as Arduino programming; Javascript is mostly used for coding interactive websites; and C#/Visual Basic and Swift are largely limited to developing applications for Microsoft and Apple platforms respectively.

Python (Years 7-10, advanced Years 5-6)

Python is a powerful general-purpose programming language that is very popular in school and university programming courses, and is also widely used in industry and academia. The syntax is very simple and consistent, it enforces good habits (such as indentation), and the standard and external libraries enable a very wide range of problems to be solved.

Because of its simplicity, Python has often been called executable pseudo-code; that is, as a programming language, it is very readable and (fairly) close to English.

In the Python program below, the ‘input’ function asks the user for their name with the prompt message. The returned name is stored in the ‘name’ variable, and then “Hello” and the name are displayed by the ‘print’ function. This program is identical to the Blockly program above:

An example of Python coding

In our Grok Learning system, students can see the Python code that corresponds to their Blockly program, which helps them see the relationship between visual and text programming.

Python can be used for embedded/robotics development on the BBC micro:bit. Unfortunately, Python does not have good support for developing graphical user interfaces, and PyGame, while fairly popular, is a difficult framework for writing games.

Ruby (Years 7-10)

Ruby is similar to Python in many ways, but the syntax is more succinct and esoteric. While this is great for professional programmers, it is harder for new programmers. For example, in most languages, you use parentheses to run (or call) a function, such as 'print('Hello')' in the Python snippet above. But in our Ruby example below, both ‘gets’ and ‘chomp’ are function calls, but the parentheses are optional (which is faster for experts, harder to understand for beginners): 

An example of Ruby coding

Use of Ruby has largely been driven by the popular Ruby on Rails web framework, and while it is a general purpose language Ruby is much less popular than Python outside of web applications.

Java (only Years 9-10, if at all)

Java is a general-purpose programming language that is widely used in industry, from Android app development up to enterprise servers and website backends. It is also a complex language to learn with an enormous standard library and heavyweight development environment.

An example of Java coding

While teaching a language that is used in industry has some merit, we strongly discourage the teaching of Java (or for that matter C++, C#, or Swift) in school, because the languages are too large and difficult to master as first programming languages. Notice how much more code is required to solve the same problem as two to three lines of Python and Ruby.

Javascript (Years 7-10)

Javascript is the programming language understood by web browsers, and so nearly all interactive websites are written in Javascript. Despite the name, it is a very different language to Java. Since Javascript is focused on browsers, it doesn’t have the simple input/output functions of the other languages. Instead, Javascript code modifies and generates HTML/CSS, which changes the look and behaviour of a website as the user interacts with it:

An example of Javascript coding

Javascript programming is largely event-driven, like Scratch, which can make it difficult to follow. In the example above, the ‘main’ function runs when the user clicks the ‘run’ button, asking the user for their name in a pop-up dialog box, and then updating the contents of the paragraph to be “Hello” followed by the name.

Summary: Weighing up the options

For primary school teachers, the choice is quite clear. Scratch is very popular as a first programming language with good reason. It inspires a wide range of students with opportunities for creative programming in many different ways. Blockly activities provide a more systematic exploration of the programming concepts and usually include some form of automated marking to confirm the student's code is correct.

For secondary school teachers, there are many languages to choose from. We believe Python is an excellent all-round language – powerful and flexible, yet accessible for beginners. Python’s one weakness is that creating graphical user interfaces or games in this programming language is not very easy, in which case I’d suggest pairing Python with Javascript in a later year, so it gives your students the best of both worlds.

Happy coding!

When choosing a programming language to use with your students, what sorts of things do you consider? How do you know the language appropriately matches the skill levels of your students?

James Curran suggests pairing languages for tasks like creating graphical user interfaces or games. Have you ever paired programming languages before? Which did you choose to use? What were the challenges you faced in doing so?

Chris 16 February 2017

First language is a problem I’ve thought about a lot. In addition to being an easy language, I think Go is the ideal first language for three reasons: static typing, pointers/arrays, and concurrency support.

The concept of types is a very important one to learn. Python and JS try to pretend that types don’t exist, which makes the teaching about types in those languages hard. When you finally get to a point where the type systems of those languages matter, it’s hard to explain. Go on the other hand has a straight-forward type systems that is easy to explain and powerful to use.

It’s also hard to teach data structures in any language without first class arrays and pointers. Java is good in this regard, but the behind-the-scene treatment of pointers is again hard to explain.

And finally, thinking about systems concurrently is increasingly important. We need to be teaching that early, and Go is the first and only language that I know of with a take concurrency that I feel like I could teach to a middle or high-schooler.

Kris 17 February 2017

I would also consider PHP as an introductory language after the visual stage. It is still a very popular language, well supported and has the ability to create graphical elements easily. It may be simpler than a move to JavaScript as the syntax is similar to Python.

Steve 21 February 2017

I have a concern that the valid suggestions of Chris and Kris do not seem to take into account the broad range of learning capacities between Years 3 and 10.  Putting it in a simplistic way, very young learners may struggle to apply the variable/differing concepts in early language.  Neither seems to address the earliest years, jumping to later years and possibly just assuming that the students have ‘got it’ by the time they start there.

Mitch 25 February 2017

Can’t say I could recommend PHP - as a server backend language aimed at web browsers, it will introduce a lot of unnecessary complexity. Web browsers, networking, statelessness, etc. And even overcoming that, they’re going to bump into major problems due to the distinction between front-end and back-end logic. Either you end up teaching them Javascript to handle front end, you ignore a huge part of the user experience, or you end up writing things in the back-end that shouldn’t be in the back-end.

I think Java should be considered a bit more. I teach it for high school students. Certainly, the complexity is a challenge, but it’s also the language that the AP Computer Science A exam uses, which requires students to have a healthy knowledge of Java and the Java Standard Library.  It’s also allowed me to open a year 2 course on Android application development.

Daniel 24 June 2017

I have found that by Year 7/8, many students have had much experience using Scratch in primary school and are ready to move on. Last year, I used PlayCanvas which is based on JavaScript and while most of the students enjoyed it, some found it a little too challenging. This year, WoofJS has been a great solution. It is also JavaScriot-based but makes for a nice transition from WoofJS to a “real” programming language. The main challenge that students will have (which is not an issue in Scratch and Blockly) is the issue of syntax errors. However, this is an opportunity to teach students good programming practise, as well as interpreting error messages and discussing types of errors and testing strategies. For Year 9, I introduce coding with HTML/CSS and full JavaScript. In the past I’ve used Python but JavaScript has been much better for when students want to move on to making real GUI programs rather than just “Hello, name” programs. Later in Year 9 and in Year 10, students have learnt C# with Unity and Xamarin and have built some amazing applications. If you have been teaching the students coding consistently, cover the concepts well and know where they’re at, then this can work really well. Otherwise, if it is the first experience they have in programming then it will most likely be too big a jump at that stage.  In Years 11-12 in the past I’ve taught Python, C#, JavaScript and PHP (I really like PHP even though it has many haters. For some solutions, PHP can be terrible. But to make a web-based app that uses a database in almost no time, PHP can be great). In the future, I’m looking at teaching more web-based Python or NodeJS. However, if teaching Programming Paradigms in Year 12 SDD then teaching an object-oriented language is really the best way to go and that’s where C# and Java stand out (although other multi-paradigm languages like JavaScript and Python work too).

Albert 16 October 2017

Python enforces good habits??? Really??? Apart from forced indentation, name one! Name a single one!
Actually, Python is EXACTLY a very bad language for beginners because it FORCES bad habits. Dynamic typing, variables are declared as they appear, tons and tons of show-offy syntactic sugars, which only make code less readable and the logic less obvious, tons and tons of very weak and lenient rules about scoping and visibility. Plus, it doesn’t have a good IDE + interpreter bundle, you have to install them separately, or work with barebones interpreter and IDLE, which sucks.

Kym 30 June 2018

Thank you for sharing your insight here - this is helpful for teachers. Can I please clarify - programming language is for writing algorithms? In the younger grades, when students create an algorithm for brushing their teeth, and it doesn’t have decision making etc., it purely describes the process - Is this an algorithm? Even without computers, students can represent this algorithm visually but does it count as solving a problem? I seem to see a lot of writing algorithms for closed problems that are procedural, and then there is a leap to more generalizable algorithms that can be applied to more abstract problems. For instance, can we write an algorithm for drawing a flower?

Judy 13 April 2019

I would like to recommend LiveCode by Runtime Revolution.  It is very Hypercard-like in terms of syntax with an enhanced IDE.  It is an event-driven language that can be used for children as well as adults with a natural language-like syntax (more so than Python), built-in UI items that are shown as native for the platform the application is compiled for, and supports Linux, Windows and MacOS as well as iOS (deployment).  Write once, run anywhere.

T 06 August 2019

Albert, what would you suggest for a motivated 5th grade beginner?  Thanks.

Leave a comment

Skip to the top of the content.