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).


Advertisement


Scratch

This is a graphical language designed to teach kids about programming. It is often used to produce games and animations that will engage kids and help them to learn.

If you want to be a serious programmer, this is probably not the language for you. If you're a youngster with no experience of programming then that's a different matter.

I will admit that, unlike the other languages here, I have never used Scratch, so I will leave my comments to this.

Python

Often referred to as the language of choice for the Raspberry Pi, Python is a good bet for general programming.

Python is a mature language with a great deal of support. It has all of the features that you would expect in a modern programming language, lots of libraries that allow you to do, among other things, mathematical computing, natural language processing, web applications, AI, the list is very long. And, of course, there are libraries to support physical computing for the Raspberry Pi.

If you want a program with a gui, you have a number of choices, from the sophisticated to the extremely simple (e.g. guizero).

Generally speaking, Python is a good choice for doing almost anything and reasonably easy to learn.
See Just Enough Python.

Java

Java is a very popular professional, language, and the Raspberry Pi comes with BlueJ and Greenfoot, which are programming environments that are designed for teaching Java.  BlueJ concentrates on object-oriented programming through a diagrammatic way of representing objects, while Greenfoot provides a graphical environment for programming animations.

A simpler, more conventional way of using Java is with the Geany editor (Geany comes as standard in Raspbian). Or you can download more sophisticated development environments such as Netbeans and Eclipse.

Java is also a good general purpose language, it has lots of libraries, including a comprehensive GUI library, but is probably a bit trickier to learn than Python. Again there is a lot of support for Java.
See a Little Bit of Java.

C

C is most definitely a professional language. Terse and with a reputation of being difficult to get to grips with, it is both fast and powerful. It’s syntax is similar to Java but is a lower level language that expects the programmer to know what they are doing. C is often used for embedded systems which do not need a gui and it is renowned for being fast to execute - only assembly language is faster.
See the post A Little Bit of C


Julia

Julia is new to the Raspberry Pi and is aimed at mathematical computing. The language itself seems robust but I am not entirely convinced that the  support is as solid. I still have yet to get the Raspberry Pi specific libraries to operate properly (although I admit to not spending too much time on it, it would be nice if it just worked!).

My personal opinion is that this is one to watch; a good language but maybe not quite ready for prime time yet. At least not on the Raspberry Pi.
See my post A Little Bit of Julia.

Conclusion

There is no one ideal languages (that's why people keep inventing new ones). But all of the above are good languages and the skills that you learn in using them are transferable to other environments, not just the Raspberry Pi.

Advertisement


Comments

Popular posts from this blog

Just Enough Python

Learn to code with C

Introduction to Python by Andrew Ng