Which language on the Raspberry Pi?

What language should you use on the Raspberry Pi? There is quite a choice, including Python, Scratch, Java, C, Julia, and that's not counting the web stuff like Javascript, Html and Php.
There is no definitive answer - it depends on what you want to do. If you are teaching a child the basics of programming then Scratch might be a good choice. If you are an older learner then you might go for Python or Java with Greenfoot.
If you are interested in programming the Raspberry Pi hardware then there are libraries for pretty much any language that will let you do that. 
If you want a graphical user interface then you may want to give C a miss. But not necessarily because you can tack on a GUI in almost any language these days.
So where does that leave us?
Here is a list of some of the programming languages available for the Raspberry Pi with my brief personal notes and an example program for each one (except Scratch).

Scratch This is a graphical language designed to teach kids about p…

Just Enough Python

Just Enough Python We have updated and moved, please follow this link.
Just Enough Python
An brief introduction that will get you programming quickly
This is a series of tutorials to get you going with Python on your Raspberry Pi (or other Linux system) . It is NOT a comprehensive guide to Python but  teaches you enough to be able to give you a flavour of the language and to produce useful programs.

Just Enough Python 0 - getting set up If you are using a Raspberry Pi to follow this tutorial and you have the latest version of Raspbian, then you already have everything you need. If you are using something else, read this first.  (Go there now)
Just Enough Python with Geany 1 Python is a great language to learn, as well as being a real professional's language. It is include in Raspbian the Pi's operation system. Here we see how to use the powerful but light-weight editor, Geany, to create and run a Python program. (Go to Just Enough Python with Geany 1)

Just Enough Python 2 Now we k…

A bit of C - a quick guide

C is the grandaddy of many modern languages. It's influence can be seen in Java, PHP and, of course, C# and C++.

If you can write large and complex programs in C then you are a serious programmer.

Not that C is a large or complex language but it does have a reputation for being difficult to use. However, if you understand the language well, it is really not so bad. The philosophy behind C is to trust the programmer - if the programmer knows what she is doing, all will be well.

And while C is an old language, it is still widely used, particularly in situations where a program needs to be compact and fast. and it remains a very popular language.

This tutorial is going to give you a quick tour of C basics. By the time you finished you will have enough knowledge to write and run programs that do something more than just say 'hello'. There are two parts, the first covers:
the basic structure of a C programhow to compile and run the second part will cover:

Introduction to Python by Andrew Ng

A free ebook or a very reasonably priced paperback that provides a very broad coverage of the Python language.

Andrew Ng is a well known figure in the world of AI and since Python is a major language in that world, you'd imagine that Ng is quite an authority on Python.

This books demonstrates that this is, indeed, the case. It is an extremely comprehensive book covering just about every aspect of Python that you might want to know about. It is a conventional book that starts with how to install the software and then moves on to the language itself. It covers data and variables, moves through operators, control statements, libraries, functions, OOP, and databases, giving a detailed coverage of each topic.You'd be hard-pressed to find anything missing.

While it is well explained, the examples are fairly trivial which, in a book of less than 300 pages, is not really very surprising, particularly given the amount of ground the author covers.


Ng is clearly an expert …

K&R - the C Programming Language

Having looked at Simon Long's book about C programming, I thought I should give a mention to the one that has been long regarded as the C Bible, and the one that Simon suggests as further reading: the C Programming Language by Brian W. Kernighan and Dennis Ritchie.

Kernighan and Ritchie not only wrote the book, they wrote the language, too (well, Ritchie did) . They then went on to revise the language and produce a new edition of the book. So if your grandfather offers to lend you a copy of K&R's first edition, just politely say, "no, thanks", it’s the second edition that you need.

The K&R book is quite short - less than 300 pages - and in two main parts, the first part is a tutorial which covers the main aspects of the language and the second is a series of chapters going into the different parts of the language in much more depth.

The tutorial gives plenty of examples albeit fairly short ones and you can get a pretty good idea of the language just from the…

Learn to code with C

C is the world's most popular language, according to Simon Long, and he is going to show you how to use it. 

The book comes from the publishers of Magpi, a magazine which is aimed at Raspberry Pi owners both beginners and enthusiasts.  It's a short book (less than 100 pages) that leads you through a language that has the reputation of being difficult to learn.

While it is aimed at Raspberry Pi users, it can be used by any would-be C programmer. Long uses the Rasbian operating system but, from the point of view of this book, it could be almost any Linux distribution And the language details are, of course, the same no matter what operating system you use.


We start off with the ubiquitous "Hello World!" program and this is entirely appropriate because the original book of the C language by Kernighan and Ritchie was where this program first appeared.

Long moves along at a good pace with short chapters on all the main features of C. We quickly go through v…

A little bit of Java

Java is a comprehensive, general purpose language. It has a ton of libraries available for it, some come built in when you get it, others you can download. One of the most important libraries, Swing, let's you build vsophisticated user interfaces.

So Java can be used to build desktop applications but it is also widely used on the web, too. The are several frameworks for building web applications. It is also the language for building Android applications.

All in all, it's a useful language to learn. 
Java is fully object-oriented (although I won't be demonstrating that, here) and inherits much of its syntax from C and C++.
Here's an example. It’s the same guessing game that I've used in my other "A little bit of..."  posts. It gives you a flavour of the language and illustrates some basic programming constructs.

import java.util.Scanner;
import java.util.Random;
public class guess {
// Start here
public static void main (String args[]) {
Random r = new Random()…

Popular posts from this blog

Introduction to Python by Andrew Ng

Learn to code with C

Thonny, Idle or Geany?