# Some guidance for beginners

**URL:** <https://discourse.processing.org/t/some-guidance-for-beginners/115>\
**Category:** Beginners\
**Created:** [May 18, 2018, 6:18pm UTC](https://discourse.processing.org/t/some-guidance-for-beginners/115 "2018-05-18T18:18:09Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [May 18, 2018, 6:18pm UTC](https://discourse.processing.org/t/some-guidance-for-beginners/115/1 "2018-05-18T18:18:09Z")

</div>

I want to give some guidance for beginners.

Mostly links to resources.

Other members, please feel free to contribute.

Thank you!

Best, Chrisir 😉

**What is programming?**

Whenever you use a computer, a program is run by the computer, be it a game or a word processor. This program defines _for the computer_ what to do with the input of the user (click a mouse on a button, enter text…). A program is a _operating instruction_ for the computer. So you go beyond _using_ a computer to _programming_ a computer. A user can later use a program that you’ve written.

A computer program in processing is called a _sketch_. The commands and structures (if this do that…) must be precise, like a dumb friend you have to tell him _exactly_ what to do.

Now you can program your own word processor or create art, either a fixed piece of art (house) or something that’s generative (it looks slightly different every time you run it because it’s controlled by random and algorithms) or with animation (movement) or make a game.

Programming can be a great hobby. Imagine a Workshop in your basement with a work bench where you make a marble track or a steam engine as a Hobbyist. Similar you can make fancy programs and create textual or graphical worlds and machines. Be creative!

But similar to a steam engine you need to follow certain rules:

- A steam engine consists of different parts, so does your sketch. Each part has its own task but they work together.
- You need a _plan_ to build a sketch. The plan might be rough or unfinished yet but you need some kind of planning ahead.
- Instead of building the engine at once you want to build it piece by piece. Similar with a sketch: Break your problem down into steps and program it step by step. Try also to put your code in sections / functions to make the steps visible in your code (modularizaton).
- Instead of finishing the entire steam engine before running it the first time, you want to test the single parts that you build. Similarly, always try to have a running sketch, simple at first but then getting more complex. When you run it often, you can test while you work and make sure everything is working. Running after a long long period of time will confront you with lots of errors. Running often you’ll find what’s causing the error: The part you changed the most recently.
- You want to keep the engine nice and shiny and so in your code from time to time you gotta do some house cleaning: Delete rests from old approaches, rename variables and functions in a better way (expressing more clearly their function), insert and check comments…

Hints:

- Start small. Save often, even with a new name for the sketch (ballGame1, ballGame2…).
- Don’t start with building a cathedral. Start with a shed.
- Use ctrl-t to auto-format your code.

Read more:

> **[How to Program](https://happycoding.io/tutorials/how-to/program)**
>
> Breaking problems down into smaller steps.

and: [https://github.com/Kango/Processing-snippets/wiki/programming-and-functions](https://github.com/Kango/Processing-snippets/wiki/programming-and-functions)

**What are variables?**

If you want to display a ball at screen position 310, 200, that’s fine. But if you want to move the ball, it gets hard. You need to add something to 310 and display the ball at 320,200 in the next scene. And then at 330,200. This ain’t possible with fixed numbers. Instead you need variables like ballX,ballY and use them for displaying the ball. They contain the value 310,200 but in a loop (draw() loops in itself automatically) you can add your speed to the position: ballX = ballX + 10;

**What are functions?**

See: [https://github.com/Kango/Processing-snippets/wiki/programming-and-functions](https://github.com/Kango/Processing-snippets/wiki/programming-and-functions)

**What is object oriented programming?**

See [https://github.com/Kango/Processing-snippets/wiki/Object-Oriented-Programming](https://github.com/Kango/Processing-snippets/wiki/Object-Oriented-Programming)

See [https://github.com/Kango/Processing-snippets/wiki/Variables,-Arrays-and-object-oriented-programming](https://github.com/Kango/Processing-snippets/wiki/Variables,-Arrays-and-object-oriented-programming)

**Typical Problems for beginners**

- How to make a ball fly I outlined above.

- The command fill() must be _before_ the command the fill color is applying to (rect() or ellipse() etc.)

- Often I see people use a mouse input but the text they want to display flashes only briefly. To avoid that set a variable `mouseHasBeenClicked` to true and evaluate the variable using if. Before setup say `boolean mouseHasBeenClicked = false;`.

- Normally a line ends with “;”. This is not true for `if`-clause! This expression won’t work:

```auto
if(mouseHasBeenClicked); // wrong semciolon ; !
    text("Hello", 20,20);

```

instead consider:

```auto
if(mouseHasBeenClicked) // no semciolon ; !
    text("Hello", 20,20);

```

- Difference between mousePressed and mousePressed(). The first without the () is a variable (boolean), the 2nd a function, marked by the (). When you want to draw with the mouse continuously, use mousePressed as a variable since it registers multiple clicks. When you want a single click event use the function `mousePressed()`. It gets called automatically by the way.

See: [https://forum.processing.org/two/discussion/8093/frequently-asked-questions](https://forum.processing.org/two/discussion/8093/frequently-asked-questions)

**Error Messages**

There are different kind of error types and messages. When asking about an error in the forum, state the error message, the line number and show your code.

Often processing just knows something is wrong but states a wrong error. E.g. missing “)” when no “)” is missing. Start by reading the passage closely and check for missing `;` at the end of line or missing variable types in function parameters etc.

**Collision**

For Collision see: [http://www.jeffreythompson.org/collision-detection/table\_of\_contents.php](http://www.jeffreythompson.org/collision-detection/table_of_contents.php)

More code at: [https://processing.org/examples/circlecollision.html](https://processing.org/examples/circlecollision.html)

> **[Processing Collision Detection](https://happycoding.io/tutorials/processing/collision-detection)**
>
> Learn how to trigger an action when objects overlap in Processing!

**Advanced topics**

> **[Happy Coding](https://happycoding.io/)**
>
> You can code. HappyCoding.io is a collection of tutorials and examples that start at the absolute basics and take you through advanced coding topics.

**Read more**

See tutorials here: [https://www.processing.org/tutorials/](https://www.processing.org/tutorials/)

Examples: [https://www.processing.org/examples/](https://www.processing.org/examples/)

Books: [https://www.processing.org/books/](https://www.processing.org/books/) - especially Nature of Code

Handbook: [https://www.processing.org/handbook/](https://www.processing.org/handbook/)

See: [https://github.com/Kango/Processing-snippets/wiki](https://github.com/Kango/Processing-snippets/wiki)

---

<div class="post-metadata">

**Author:** ![Kevin](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kevin/32/2297_2.png) [@Kevin](https://discourse.processing.org/u/Kevin)\
**Post date:** [May 18, 2018, 9:46pm UTC](https://discourse.processing.org/t/some-guidance-for-beginners/115/2 "2018-05-18T21:46:54Z")

</div>

Aw thanks for including Happy Coding on this list, warms my heart! 🤗

Any list of Processing resources is incomplete without @shiffman!

Website: [http://shiffman.net/](http://shiffman.net/)  
Videos: [https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1\_aw](https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1_aw)

I especially recommend perusing the videos, particularly if you’re just starting out.

---

<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:** [March 28, 2019, 5:02pm UTC](https://discourse.processing.org/t/some-guidance-for-beginners/115/3 "2019-03-28T17:02:02Z")

</div>

To search this forum using Google use

[https://www.google.com/search?q=ruler+site%3Ahttps%3A%2F%2Fdiscourse.processing.org](https://www.google.com/search?q=ruler+site%3Ahttps%3A%2F%2Fdiscourse.processing.org)

To see a brilliant discussion / collection of links of art projects see:

> [@Places online where documentation of amazing projects exist](https://discourse.processing.org/t/places-online-where-documentation-of-amazing-projects-exist/3601/5):
>
> What a great initiative @bmoren ! I’m constantly on the lookout for new coders/artists to discover (like many people here I presume) and have always thought it would be nice to have a place on this forum to share and discuss our personal favourites. May I suggest to extend your list to cultural events (exhibitions, festivals) and publications (books and magazines) evolving around media art ? I think they can be great places to find documention. Not only they bring together the work of different…

---

<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:** [March 28, 2019, 5:59pm UTC](https://discourse.processing.org/t/some-guidance-for-beginners/115/4 "2019-03-28T17:59:09Z")

</div>


