Processing has it's own programming language

edited February 11 in Hello Processing

A colleague tells me that, when using Processing, you're not developing code in Java but using the Processing language which is a cut-down version of Java. This is because of the following lines in Wikipedia:

"Processing is an open-source computer programming language and integrated development environment (IDE) built for the electronic arts, new media art, and visual design communities with the purpose of teaching non-programmers the fundamentals of computer programming in a visual context. The Processing language builds on the Java language, but uses a simplified syntax and a graphics user interface."

I was surprised as I thought it actually did use Java. All IDEs nowadays can build scaffolding around code to assist with many complex or common Java programming tasks and I, quite wrongly it seems, thought that Processing worked with Java in much the same way. Could you confirm that Processing does come with it's own programming language?

Many thanks.

Answers

  • edited February 11

    As it says, it's "built on Java" so you can use all of Java(7) within processing. Where processing wins is in the visual department - it has simplified everything you need to draw anything to the screen. You can think of this as a language, or you can think of this as a library, it depends.

    (There are other things it does to simplify coding like get rid of the need for a main method, automatically calls draw, defines a color primitive, stuff like that. The code you write in the editor actually ends up as an inner class within a processing class (so actually not everything you can write in Java will work))

    Look at some of the examples, you'll recognise the Java syntax, you'll see the added methods.

  • Thanks for your very quick answer Koogs.

    Yes, I totally agree with all you said. But I just wanted somebody to let me know if it has it's own language as Wikipedia says it has. All IDEs simplify code development for pretty well all computer languages and application areas by adding some form of, often quite complex and powerful, scaffolding, however they don't say they have developed their own languages. It therefore does seem that Processing has its own cut-down Java-type language. But common sense tells me that that would be a very odd thing to bother doing.

    You can think of this as a language, or you can think of this as a library, it depends.

    A language has key words, syntax, semantics plus a compiler or interpreter. A library is made up of generally compiled code developed using a language. They have both been around for a long time without people seeing them as being somewhat interchangeable but, then again, your "it depends" might be alluding to some sort of new hybrid. If people were required to develop their code using Java syntax, the IDE used the JDK to compile it and JRE to run it, then I would say it was Java. Then, if they clicked on Python mode, and it used the Python runtime and support libraries, then I would probably call it Python (or Jython if that's still around). But then again I am just a simple developer.

    So the big question is - have they developed their own language with, I would assume, its own compiler or interpreter?

    I need to know this as two colleagues and I are running a code camp for students of three co-located high schools. We're using Processing for Android (because it's quite obviously awesome). However, we need to tell them they are learning either, in our case, Java for Android, or a new language called Processing.

    Thanks.

  • Answer ✓

    It has a pre processor, which converts things from 'processing' into Java which is then compiled. The pre processing is quite light though.

    Yes, it's complicated by the fact that the processing bits have also been implemented in JavaScript, python etc

    So maybe it's not a language but slang or jargon.

  • Answer ✓

    Yeah, I think it’s not black or white.

    Processing is a wrapper for java essentially wrapping a few things of java so it’s simpler.

  • Answer ✓

    I believe it is better to think of Processing as an IDE because it supports development in multiple languages (i.e. modes).

    Java Mode (the default mode) supports the creation of desktop applications using the Java programming language. The pre-processor simplifies the development by
    # removing the need to learn OO syntax and semantics (needed for pure Java)
    # providing a library of methods to simplify the code needed to use graphics, sound, video etc.

    Could you confirm that Processing does come with it's own programming language?

    The answer is no, it is simply an IDE.

  • Thanks everybody!

    I can see that the pre-processor does make the answer a little tricky. This gives me enough information I think to be able to be able to give a "correct enough" explanation to the students. I think I should also tell them about this forum in case they zoom past us in the course. :)

  • edited February 11 Answer ✓

    I'd say that if the Processing library (PApplet class mostly) is used under Processing's own IDE (PDE) w/ ".pde" files, it is quasi-Java, b/c it changes some bits of Java's syntax here and there, which needs some preprocessor in order to transpile those ".pde" files into 1 validly compilable ".java" source code. :ar!

    When used under an IDE which doesn't recognize ".pde" files, only ".java" 1s, Processing is just another regular Java library. ~O)

  • Right. A key point for students is that while Processing is a Java library, the reference / examples / documentation are written in a dialect that (in many cases) only compiles inside the Processing IDE -- the dialect is not valid Java until preprocessed. This is a bit different from scaffolding.

    A useful point of comparison for explanation might be something like SASS / SCSS and CSS, which is preprocessor-based with the goal of outputting valid CSS. In the case of SASS, one goal is to make CSS more expressive. In the case of Processing in the IDE, one goal is to make Java more accessible to beginners.

Sign In or Register to comment.