Arduino, Processing and p5.js similarities

Hi all,

I’m wondering if someone has any insight on why, when Arduino is a C+ library (is it a library?), Processing a Java library, and p5 a JavaScript library, the three are so similar in terms of syntax? It strikes me that when you know one it’s pretty straight forward to pick up the other two. How is this possible if they belong to three languages that I’ve heard people describe as being extremely different from each other?



Processing is indeed a library (and also a programing environment).

The similarity is simply due to p5.js being the JavaScript version of Processing and Arduino being intentionally built to resemble Processing.

In other words, first came Processing, then they built a version of Processing (Java) for JavaScript(p5.js).

As for Arduino, as far as i know, the developers of Arduino liked Processing a lot and made their library similar to it because of this.

Edit : I assumed, that with syntax you meant things like names of methods, classes and such (since these are the similarities between the libraries).

If you were refering to actual syntax, then they aren‘t similar, as @jeremydouglass described. :sweat_smile:


Thanks for the backstory. I didn’t know it was possible to make the syntax of the library of one language resemble the syntax of a completely different one!

1 Like

Often the similarity isn’t the syntax, except to the extent that the languages are already related (eg in the C family of languages) – instead the similarity is the keywords-function/method names, and their arguments: the API.

So, for example

void draw() {
def draw():

These don’t have the same syntax – : { ; whitespace, keywords are all different, and only the use of () is the same – but they do have the same API (“draw” and “background”)


This is very interesting! Thanks for helping to complete the picture for me Jeremy :slight_smile: What kind of code is the second example that you gave?

Python Mode: :snake:

Although there’s a slightly error there: def draw: -> def draw(): :bug:


Yes, sorry for the typo – () is the same.

In addition to Java and Python, here is Ruby (JRubyArt):

def draw
  background 0

…and here is p5.js:

function draw() {

…and here is R mode:

draw <- function() {