Advice for understanding Processing 'under the hood'

Sometimes I run into something about Processing that I think is super useful but isn’t obvious from the surface level documentation, such as this answer to a query from the old Processing forum:

the PGraphics object used as the main drawing surface for a sketch is called g. 

When I read something like this, I think ‘I definitely should have known that’, then I look for info about it in the surface level docs, but often I don’t find anything. Reading the entire core docs doesn’t seem like a very efficient approach…

Can anyone recommend a useful resource that lives between the core docs and the surface docs? Or can you recommend a strategy for figuring out what I don’t know that I should, that’s not in the surface docs?

Many thanks.

2 Likes

I have created several libraries for Processing and it is impossible to document everything that someone else might find useful. When you consider the size of Processing the task becomes impossible.

Processing has a very useful reference section and users must be careful if they use anything that is undocumented because the developers are not promising it will be available in later versions.

The first version of Processing I used was V1.2.1 and if I remember correctly the reference strongly recommended not to use the variable g because it might be changed at some later date. I don’t think that restriction is still in effect but I haven’t looked.

If you think you have found something useful you can always ask on the forum if anyone else has used it and what for.

4 Likes

http://Processing.GitHub.io/processing-javadocs/core/

5 Likes

A really Great question @MuddyGardener !!
I have sometimes wondered this myself.

I appreciate reading @quark 's reality check that :

:nerd_face:

2 Likes

Hello @MuddyGardener,

I often explore the source code to see what is going on “under the hood”:
https://github.com/processing

PApplet.java has a lot of the “helper functions”:
https://github.com/processing/processing4/blob/main/core/src/processing/core/PApplet.java

For example the dist() function:
https://github.com/processing/processing4/blob/main/core/src/processing/core/PApplet.java#L4565

:)

1 Like

Hi @MuddyGardener,

I would also recommend to study the sources for processing on GitHub. There are quite well commented sections in the code, which sometimes can be very helpful to find out what happens under the hood…

Cheers
— mnse

3 Likes

Yes, good point about the risks of going offroad and trying to be ‘clever’ but in doing so, relying on things which may change. (As a learner, I have been finding there are things about Processing that would be ultra obvious if you knew Java, but if you don’t, aren’t. Fortunately the help community is very helpful.)

4 Likes

Useful reference - thank you.

1 Like

Ha ha - as they say, “the code is its own documentation”. I was afraid that was the answer ;-). - useful to know I’m not missing some other resource, though.

2 Likes

Only if it is well written and the reader has the skills to understand it LOL

As to using undocumented code, I’ve just remembered an issue I raised on github related to using GUI Builder with P4. If you are interested I have linked to the issues here -

Issue 545 - read first
Issue 596 - follow up to 545

2 Likes

That is indeed a place I want to go soon. Thanks.

1 Like

Hello @MuddyGardener,

Also explore the Wiki:

:)

1 Like