# Good practice / revisioning / template / backup

**URL:** <https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615>\
**Category:** Beginners\
**Created:** [January 18, 2019, 5:55am UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615 "2019-01-18T05:55:21Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 18, 2019, 5:55am UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/1 "2019-01-18T05:55:21Z")

</div>

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 )

> **example**
>
> ```auto
> /*
> 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/revisioning.pde
> /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:
> https://www.gnu.org/licenses/copyleft.en.html
> kll-engineering
> 01/2019
> [CC BY SA] https://creativecommons.org/licenses/by-sa/4.0/legalcode
> or Public Domain [PD]
> [CC0] https://creativecommons.org/publicdomain/zero/1.0/
> _____________________________________________________________
> 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() {
> surface.setTitle(mytitle+rev);
> println("canvas: "+width+" * "+height);
> println("operational concept: \n key :\n mouse : wheel -> radius");
> // static look 
> fill(0, 200, 0);
> stroke(200, 0, 0);
> strokeWeight(width/20);
> 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 ) {
> println("LEFT");
> }
> if ( mouseButton == RIGHT ) {
> println("RIGHT");
> }
> if ( mouseButton == CENTER ) { // hardware and OS dependency
> println("WHEEL");
> }
> }
> 
> 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
> /sketchbook/templates/Java/sketch.pde
> */
> 
> ```

- 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  
[https://github.com/processing/processing/wiki/Templates](https://github.com/processing/processing/wiki/Templates)  
the idea is to save a good prototype / like above code example / as a template to  
/sketchbook/templates/Java/sketch.pde

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

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [January 21, 2019, 7:22pm UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/2 "2019-01-21T19:22:27Z")

</div>

Thanks for sharing this.

> [@kll](#):
>
> a good practice beginner info sticky

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

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [January 21, 2019, 11:56pm UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/3 "2019-01-21T23:56:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ddownn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ddownn/32/2731_2.png) [@ddownn](https://discourse.processing.org/u/ddownn)\
**Post date:** [November 24, 2019, 2:04pm UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/4 "2019-11-24T14:04:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 25, 2019, 3:06am UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/5 "2019-11-25T03:06:55Z")

</div>

thanks,  
as i use windows or RASPBIAN i search for a google tool,  
and found “google KEEP”  
[https://play.google.com/store/apps/details?id=com.google.android.keep&hl=en](https://play.google.com/store/apps/details?id=com.google.android.keep&hl=en) ,

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?

* * *

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 25, 2019, 12:00pm UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/6 "2019-11-25T12:00:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 25, 2019, 12:08pm UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/7 "2019-11-25T12:08:48Z")

</div>

good, but in what form you want to “transport” ? “teach” that?  
the [https://processing.org/reference/class.html](https://processing.org/reference/class.html)

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [November 25, 2019, 4:44pm UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/8 "2019-11-25T16:44:55Z")

</div>

> [@Chrisir](#):
>
> 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.

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…?

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 25, 2019, 5:12pm UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/9 "2019-11-25T17:12:19Z")

</div>

Yes, that’s it.

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

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 25, 2019, 5:49pm UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/10 "2019-11-25T17:49:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [November 26, 2019, 1:17am UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/11 "2019-11-26T01:17:19Z")

</div>

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.

[https://processing.org/examples/](https://processing.org/examples/)  
section objects ?

or stay within the forum? good place:  
[https://discourse.processing.org/c/teaching](https://discourse.processing.org/c/teaching)

* * *

also i think it should not begin with

- how to write classes

better start with when and why use classes.

---

<div class="post-metadata">

**Author:** ![Tiemen](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tiemen/32/5477_2.png) [@Tiemen](https://discourse.processing.org/u/Tiemen)\
**Post date:** [November 26, 2019, 7:47pm UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/12 "2019-11-26T19:47:32Z")

</div>

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.

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

---

<div class="post-metadata">

**Author:** ![ddownn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ddownn/32/2731_2.png) [@ddownn](https://discourse.processing.org/u/ddownn)\
**Post date:** [December 12, 2019, 12:02pm UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/13 "2019-12-12T12:02:55Z")

</div>

I have been trying [Working Copy](https://workingcopyapp.com/) and I probably will not go back to using Notes, as I mentioned previously. Its only for iOS though.

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [December 13, 2019, 1:13am UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/14 "2019-12-13T01:13:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ddownn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ddownn/32/2731_2.png) [@ddownn](https://discourse.processing.org/u/ddownn)\
**Post date:** [December 13, 2019, 2:32am UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/15 "2019-12-13T02:32:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [December 13, 2019, 3:06am UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/16 "2019-12-13T03:06:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ddownn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ddownn/32/2731_2.png) [@ddownn](https://discourse.processing.org/u/ddownn)\
**Post date:** [December 13, 2019, 3:36am UTC](https://discourse.processing.org/t/good-practice-revisioning-template-backup/7615/17 "2019-12-13T03:36:42Z")

</div>

Just a repository manager.
