Any one-sheet cribsheet for beginners?

Hello all - it would be very useful if there were a very short summary of the most common idioms needed by beginners, which I could give out to high-school kids I am helping learn Processing.

Does anyone know of any such?

Search engines are a bit hopeless in finding anything due to the generality of the term "Processing" :).

Tagged:

Answers

  • Rather than search on Processing try 'programming idioms' that will provide better results that are still valid for Processing.

  • One of my favourites is garbage in - garbage out :)

  • In the Common Questions category, I grouped a series of articles trying to tackle some base idioms, and some recurrent errors we see in the forum.

    Note: if you search from the main site (the search box of the main page), you will get a Google search focused on the Processing site, so you will get more relevant results (but it excludes good sites external to this one, alas).

  • there is a full length, full text reference here

    http://www.clairdunn.com/reference/complete-ref-alpha.pdf

    it's ~ 220 pages

  • Thank you Chrisir - but your 220 pages is a far cry from the one-page summary that I was hoping to find.

    And quark - I didn't find a "garbage in - garbage out" page - I hope you were not calling my message garbage?

    I really just wanted something that can clarify the simple "Chapter 1" material - the arguments to background, fill, booleans, loops, etc.

  • edited June 2015

    just write your own

    One-sheet cribsheet for beginners

    This basic sketch shows Animation

    // this is a comment
    int pos = 0; // pos is a variable with value 0 
    
    void setup() {
        size (400,400); // comment: window size
        frameRate(44); // speed
    } // end of function setup()
    
    void draw() {
        background(204);
        pos++; // increase pos 
        line(pos, 20, pos, 80); // use pos 
        if (pos > width) { 
        pos = 0;  // reset 
        }
    } // end of function draw()
    

    Use of mousePressed()

    // Click within the image to change 
    // the value of the rectangle
    
    int value = 0;
    
    void draw() {
      fill(value);
      rect(25, 25, 50, 50);
    }
    
    void mousePressed() {
      // when a button is pressed down
      if (value == 0) {
        value = 255;
      } else {
        value = 0;
      }
    }
    

    Use of Mouse Position

    void draw() {
      background(204);
      line(mouseX, 20, mouseX, 80);
    }
    

    A simple for-loop (iteration)

    for (int i = 40; i < 80; i = i+5) {
        line(30, i, 80, i);
    }
    

    (use this inside the basic sketch above)

    A simple if-clause

    void draw() {
      background(111);// clear the background  
      stroke(255);    // Set the color to white
      int i = mouseY; // store the y position of the mouse  
      if (i < 35) {   // When 'i' is less than 35...
        stroke(0);    //...set the color to black
      }
      line(30, i, 80, i); // draw a line with y-value 'i'
    }
    

    If-clause with else

    void draw() {
      background(111);// clear the background  
      int i = mouseY; // store the y position of the mouse  
      if (i < 35) {   // When 'i' is less than 35...
        stroke(0);    //...set the color to black
      } else {
        stroke(255);    // Set the color to white
      }
      line(30, i, 80, i); // draw a line with y-value 'i'
    }
    

    Further reading:

    look at the first 6 tutorials

    https://www.processing.org/tutorials

    and the reference

    https://www.processing.org/reference

  • I was not calling your message garbage.

  • just write your own one-page sheet with my entries e.g.

  • background(202); is a gray value. 0 means black, 255 white.

    background(255,0,0); delivers red. Three values mean red, green and blue. All three go from 0 to 255. You can compose all colors by using this (in the menu is a color selector).

    fill and stroke work the same way. fill for the area, stroke for the outline.

    Basic figures

    point - x,y

    line from x,y to x2,y2

    rect from x,y with width and then height

    ellipse from x,y and width and height

    triangle with three times x,y

    Basic variables

    variables can have a name, a value and a type.

    boolean vars are truth vars: can only be true or false

    int vars can be negativ or positive integers

    float can be floats

    e.g. float a = 2.5;

  • Many thanks Chrisir - I will procede and try to build a one-page summary based on that.

    Quark - I was just checking :).

  • When I taught programming to beginners the main problem they experienced was how to find and correct their program based on the error messages.
    I was forever interpreting error messages for them. For instance mis matched braces, missing semi colons. You might find it useful to have a crib sheet providing stratagems for different types of error.
    You can get the students to help by noting errors, noting the code mistake and then noting the correction. This will help the students develop as problem solvers.

  • when you give the one-page reference online you can just make links into the reference

Sign In or Register to comment.