Good practice / revisioning / template / backup

my english is not good enough for a tutorial,
but i have a idea about a
good practice beginner info sticky

  • revisioning
    it could be a good idea even for small tests to start with a revisioning system
    easy just as some comment lines
    // rev 0.77b
    and some info what you changed, what you published ( like here to a forum post )
    or even show it in the header ( window title )
 use a longer description for your project:
 here want test a basic layout of a processing sketch
 using a revision number system
 also the usual info about file(s):
 /revisioning/data/optional data files like images, fonts, data csv...
 means you can only "distribute" as zip of the 
 /revisioning/ directory
 and optional info about copy left:
 [ CC BY SA ]
 or Public Domain [PD]
 [ CC0 ]
 and a revision list:
// v0.0  start this
// v0.1b internal revision / tests
// v0.1  public rev : posted at forum
String rev=" v0.1";
// canvas window layout:
String mytitle="my project";
int mywidth=500, myheight=500;
// animation:
int cr=0;                             // ellipse radius see mouse wheel

void settings() {
  size(mywidth, myheight);

void setup() {
  println("canvas: "+width+" * "+height);
  println("operational concept: \n key :\n mouse : wheel -> radius");
  // static look 
  fill(0, 200, 0);
  stroke(200, 0, 0);
  cr = width/2;                        // ellipse radius setup

void draw() {
  background(200, 200, 0);
  ellipse(width/2, height/2, cr, cr);

void keyPressed() {
  println("key "+key+" keyCode "+keyCode);

void mousePressed() {
  if ( mouseButton == LEFT ) {
  if ( mouseButton == RIGHT ) {
  if ( mouseButton == CENTER ) {  // hardware and OS dependency

void mouseWheel(MouseEvent event) {
  float e = event.getCount();
  cr += e;                        // hardware and OS dependency
  println("e "+e+" radius "+cr);

 if you want this to be the template to come up 
 when you start (a new) processing sketch pls. save it as

  • template
    it might be not too much used,
    so possibly you felt bad already
    that a new sketch comes up empty and you have to type the defaults again and again
    the idea is to save a good prototype / like above code example / as a template to

  • backup
    YES make backups!
    we all learn the hard way when loose some code, projects, OS installations or hard drives…
    and also about processing ( or arduino projects ) i have tried many ways:

    • “save as” MyProject_v02
      can help to save each revision under a different name,
      but if all works well you end up with a lot of project entries you never use again
      • so possibly better first make a sub directory for each project in development??
    • zip it away
      now you can zip a project or the whole sketch dir
      and you can save that even to a other drive or computer ( daily ? )

but that is only part of the story,

    • what if you want to work on 2 computers ( but same project )
      • i have tried to have the sketch dir on a USB stick ( worked well for 2 years )
        ( so actually had no backup but available on ?every? computer )
      • run google drive on windows and have the sketch dir on it
        • so automatic backup and availability even in a “remote” team
          but after 3 years i had 9000 files and 3GB usage on google drive and the
          boot of the old PC was delayed 5min?
        • a cleanup by “move to zip” did actually not help too much
          ( by zip to PC and reset will loose all the original google files ( spreadsheets… ))

so i think for above 3 points there is a lot of knowhow with the experts
i hope they want to share.


Thanks for sharing this.

Do you mean, revise this into a sticky post on the forum – or as entries in an FAQ?

who ever works on tutorials or any "using processing “intro” "
what reaches beginners might pls. think of that points.
( and translate it, LOL )

On the Mac I have found it very helpful to use the Notes app to do something similar.

At the top of each .pde file I add a comment like “// filename” and append numbers and letters for revisions and just paste it to a new Note.

Then when things are working well in a sketch and I’m about to start making changes that might not be successful, I make a new Note and paste the sketch in there. If the changes work okay, I might change the name a bit in the comment do differentiate it, but I don’t necessarily have to actually rename the .pde file. If I want to go back to a previously working version, just find the Note, and copy/paste all the code back into the .pde file.

One downside is that code in tabs might be a bit difficult to manage in this way.

Some advantages are that Notes are attached to iCloud and easy to access from multiple computers, it’s easy to group Notes into folders and yet still see a list of all Notes without looking through all the folders, it’s easy to search for a note with any text string which can be a snippet of code or a comment in the code, etc. Also, they can be sorted by Date Created, Date Modified, or Title which is essentially the first line in the Note, and essentially the .pde file name if the first line is “// filename.”

You can have piles of history for a sketch always accessible without having piles of sketch folders and directories that have to be backed up and maintained.

I don’t know if there’s something like this in Widows or Android, but I have found it works great in Mac.


as i use windows or RASPBIAN i search for a google tool,
and found “google KEEP” ,

wondered if i need to install something on win ( no, its a browser app )
on android can add install it as app

so i started it and WOW see a nice picture i put there 2014
with a so-called checklist ( test )
! and never used it again. LOL !

so i will try your idea and check it out for coding
( snippets )

for organizing i only see a label feature?

What I like is some guidance to clean code.

E.g. when you have a class Particle you don’t want to use a for loop inside of it to display all the particles.
Or you don’t want to use from a class an object that is situated at sketch level.


good, but in what form you want to “transport” ? “teach” that?

Like a long FAQ for common programming problems? With a Classes section, and an entry “Don’t loop over objects inside an object” that people can then directly link to when giving forum feedback…?


Yes, that’s it.

Is there a tool that makes a quality check and gives you feedback about the architecture of your Sketch?

I‘d say that would be a good idea. Using your example of a particle class, you‘d check for for loops within a class that goes over other instances of that class in a global variable… or just checks for accesses to global variables from within classes (would probably make more sense and still work in this case)…

Although then things like mousePressed would probably return „unclean“ if used in classes… and generally using processings methods in classes should also be as unclean (as far as i know)…

Oh well, maybe that could be avoided by having exceptions… but that‘s gonna be a Long list (pretty much all classes/variables that are not self-written)…

good points, thank you,

how about we stop preaching beginners, who not yet learned about

  • variables
  • functions

that they should start with classes…

again, where we do this best?
processing FAQ and WIKI not,

  • reference/class.html
    ok, or should have a link to it.
section objects ?

or stay within the forum? good place:

also i think it should not begin with

  • how to write classes

better start with when and why use classes.

1 Like

I feel it’s going a bit off topic from kll’s original idea, which seems to be guidelines for managing sketches if I understand correctly, but nonetheless interesting suggestions and ideas.

Responding to what’s being discussed right now, I think the best location for guiding beginners through the basics is when they open Processing for the first time. I’m assuming that most (absolute) beginners simply use their search engine and end up on the download page, followed by installing and opening Processing. At his point most of them are probably unaware of the reference page, the tutorials, our forum, the implemented examples, etcetera.

I’d say that if you want to make them aware of the information that’s already out there, this would be the perfect place for it.

Another idea would to make a library* with examples of questions/problems we often encounter on this forum. For instance, an example which clearly explains the difference between global and local variables. Or a sketch that clearly shows a proper structure of a sketch, including explanations why it’s good to structure it that way.

Library might not be the right term, I meant PDE examples (thanks kll for pointing it out)


I have been trying Working Copy and I probably will not go back to using Notes, as I mentioned previously. Its only for iOS though.

Wait, can you also use that like the iCompiler??

It doesn’t directly integrate with iCompiler, but you can copy/paste into Working Copy and keep sketches in Github easily.

1 Like

Ah ok, so it‘s not possible to run the code. Oh well :sweat_smile: would‘ve been nice if it was possible.

Just a repository manager.

1 Like