Guidelines—Asking Questions

This guide is meant to offer suggestions that will help you ask questions. Keep in mind that the developers of Processing, and the people answering questions here, are all doing this for free in their spare time. The best way to get better help is to make it easier to answer your question!

Here are some tips to help make your question easier to answer:

Is your question specific?

It’s very hard to answer general “how do I do this” type questions. It’s much easier to answer specific “I tried X, expected Y, but got Z instead” type questions.

For example, a question like “How do I draw a garden?” is a pretty broad question. There are a bunch of different ways to approach it, and how you approach it depends on a lot of things that haven’t been decided yet: what do you want the garden to look like? What code have you written so far? What exactly are you confused about?

Compare that to a question like “I’m trying to draw a flower out of circles using the ellipse() function. I thought this code would draw 4 red circles with an orange circle on top of them, but the circles are being drawn on top of each other in the wrong order. Here’s the code I’m using so far…” This question is much easier to help with, because it’s a specific question about a specific piece of code.

Is your problem isolated?

It’s good to include code in your question, but you should only include the code that’s directly related to your problem. It can be very helpful to create a new blank sketch and only add as much code as is required to show the problem.

In our example of somebody asking about the flower in their garden scene, consider this code:

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

PImage background;

Minim minim;
AudioPlayer song;

void setup() {
  background = loadImage("background.png");
  minim = new Minim(this);
  song = minim.loadFile("song.mp3");;

void mousePressed() {
  // 100 lines of code for adding a butterfly

void draw() {

  // 100 lines of code for drawing grass

  fill(255, 128, 0);
  ellipse(100, 100, 100, 100);

  fill(255, 0, 0);
  ellipse(50, 50, 100, 100);
  ellipse(150, 50, 100, 100);
  ellipse(50, 150, 100, 100);
  ellipse(150, 150, 100, 100);

  // 100 lines of code for drawing clouds

This code has a few problems.

  • It loads the Minim library, which is not related to the problem.
  • This code will not run for anybody else, because they don’t have the song.mp3 file.
  • It uses a background image that’s not related to the problem.
  • This code will not run for anybody else, because they don’t have the background.png file.
  • It contains a mousePressed() function that’s not related to the problem.
  • It contains hundreds of lines of code for drawing grass and clouds.

All of these make it harder to understand the actual problem. Compare that code to this code:

size(200, 200);

fill(255, 128, 0);
ellipse(100, 100, 100, 100);

fill(255, 0, 0);
ellipse(50, 50, 100, 100);
ellipse(150, 50, 100, 100);
ellipse(50, 150, 100, 100);
ellipse(150, 150, 100, 100);

This is a full Processing sketch that contains only the code that’s directly related to the problem. This is much easier to debug and talk about.

Note that if you post extra code, you might be asked to narrow your problem down to a Minimum, Complete, Verifiable Example. This just means that you should try to isolate your code into a smaller example. Eliminate dependencies on libraries and external files, and get rid of any code that isn’t part of what you’re asking about.

You’ll often solve your own problem in the process of coming up with a simpler example that demonstrates the same behavior!

Are you working in small steps?

It’s always better to write code a few lines at a time and to test those lines as you go. Don’t try to write everything all at once, and don’t wait until you think you’re done to test your code out!

Break your problem down into smaller steps and take those steps on one at a time.

This will help you isolate your problem—if you’re working in small steps, you should know exactly which step you’re asking about. Then you can create a simple example program that just shows that one step.

Think about somebody who wrote a sketch that draws a whole garden scene. They’ve written hundreds of lines of code, but haven’t tried running it at all. When they finally do run it, nothing looks right and they get a NullPointerException in their code. It’s going to be very hard to help with this, because they don’t have just one problem.

Compare that to somebody who has been working in small steps. They’ve isolated their flower-drawing code into a single function that runs without needing any other functions. They’ve been testing as they’ve written the code, so they know the problem is in the drawFlower() function. This problem is much easier to solve.

Can we run your code to see the same thing as you?

When you’re putting together your example, double-check that other people can copy and paste your code to see the exact same thing as you. This means eliminating dependencies on external files and libraries.

Consider creating an example using CodePen or the P5.js editor so people can visit a URL to run your code.

You can use these CodePen templates:

Remember: the easier you make it for people to help you, the more help you’ll get!

What happened when you debugged your code?

Debugging is a huge part of programming. As you write code, you should constantly be reading though it line by line and testing that it’s working how you expected. Test your code as often as possible- try running your program every time you write a line of code and double-checking that the line of code is doing what you thought it would.

If your code is behaving differently from what you expected, the first thing you should do is read through your code line by line. Use a piece of paper to record the values of variables and to trace through the code. Then compare that to what actually happens- use println() or console.log() statements to figure out exactly what the code is doing. Try to pinpoint exactly where the execution of the code differed from what you expected it to do.

If you aren’t sure how to debug your code, here is a more general guide on debugging. If you’re running in a browser, make sure you check the JavaScript console for errors. If you’re getting an error message, try googling the error message. Chances are other people have had the same problem before!

What has your research told you?

A lot of programming is not actually typing code: it’s reading documentation, trying out examples, looking through references, googling, and consulting sites like Stack Overflow.

Make sure to include the research you’ve done.

For example, consider this post:

This code doesn’t work, and I don’t know why.

Compare that to this post:

This code draws the red petals over top of the orange center. I’ve tried googling “Processing draw order of shapes” and found this which talks about the PShape class, but I just want to draw basic circles. How do I draw the red petals underneath the orange center?

This question shows a lot more research and asks more specific questions that other people can help with.

Is your post formatted?

Proper formatting can make your post easier to read, which makes it easier for us to help you. Here are a few things to keep in mind:

  • Use punctuation.
  • Use multiple paragraphs. A wall of text is hard to read, so break it up with newlines.
  • Avoid using abbreviations like “u” instead of “you”.

Don’t forget to format your code! To format your code, highlight it and press the code button (it looks like </>) in the editor. This will surround your code with three tickmarks:

// code goes here

These three tick marks will preserve your code’s indentation and add syntax highlighting, which makes your code much easier to read.

Are you posting anywhere else?

If you’re posting to multiple sites, please link between the crossposts so we can see what help you’ve already received. A simple message like “By the way, I’m also posting this on Stack Overflow. Here is a link to that post…” is enough.

Convert java bufferedimage to PImage
Question about changing color over time
I want to know how this is expressed. 03
Question about Draw Arrays
Array with 2 of the same value
Creating a Pong using tutorials
I need help with my code(scale problem)
Gradient along a row of squares
Flip the image HORIZONTALLY
My recorded DXF file turns up tilted when I open it in CAD
Debug to processing pjs from processing 3
How to create button that makes lines of text appear randomly
Need help with these codes! (array)
About p5.js sketch
Hello. I am just a beginner. I want to know how to complete a jump
Object help new user
Help with making a calculator
Screen flickering when running Particle system
Different background, Different item by mousePressed
Connect dots with lines
I need help asap BEFORE 19:00 PM
How to check for similar number in array and bring out a error sign
Pregunta mouseDragged , control en función draw
How to save an image from sketch windows
macOS question pixels[loc] issue
Why am I receiving NaN? What's wrong?
Random class from book of nature of code
Help me program how to win in tic tac toe
Can't figure out how to get a value stored/used after clicking (calculator)
A question about my code (video)
Constrain() function / mouse click on button
Multiple levels
How do I get the mousePressed function to change to different words each time on p5.js?
Importing SVG to p5.js sketch
Processing.sound not working
Applying filter to a specific region of a window
Not able to install processing
Separate objects in an ArrayList
Issues on installing Kinect - Cataline osx
I would like to use the badwitch effect on the images in the "date" folder and export it to the "output" folder
There is an error, so I ask for advice: The program freezes. The program takes a lag
Is it possible to show p5js program in Google Sites web site?
How do I make the snake's tail add on when i hit the apple?
Saving AudioSample as a sound file of any format
p5.Vector returns strange and negative x and y values
How do you choose what class you add to a list with a variable?
Lost keyPressed events
How Do you change the rotational origin for a shape?
Click and Drag to Scroll
ArrayIndexoutofboundsexception: 9
Access SVG file path ID for plotting data into it
A function that takes in a function Y and a number, and returns a function which when called, invokes Y some number of times
Data from PDE to Arduinio IDE on continual basis
Text in loop to in several rows
Data from PDE to Arduinio IDE on continual basis
Help on loops (I'm a beginner)
Need help with dist()
How can i make exp system
Preguntas Frecuentes (FAQ/Guidelines)
Cloud Animation - Processing Basics
Helping students with their homework
Helping students with their homework
Help with Shapes (Smiley Face)
I have a problem to ask
Helping students with their homework
Helping students with their homework
Is there a way to do this progressively?
Arduino - processing: serial data to toggle mp3 file in minim
I want to know how this is expressed. 01
Help with static methods!
Adding parent class to arraylist with internal function
Fibonacci spiral
Help with following code
Move the character by pressing up key
Data visualization with own images
Flow of my program
Is it possible to construct PDFs by merging many PGraphics?
Data visualization with own images
Need help scrambling an image
How to add stroke/fill/colour options to svg shape
John Whitney Arabesque
Present random shape, then fixed order (assignment help)
Multiple line graphs
P5 crashes chrome
Must qualify the allocation with
Creating ellipses with different colours and sizes
Custom classes with many drawing components?
Position problem
Need help in processing function
Assignment due soon i need help pls
Webcam Bar code/ QR code Read
[RESOLVED] A game menu with three levels
I can't describe what's my problem
How to solve p5.js problem
Balls fall then loop and restart at random position
Having multiple moving objects collide detection issues
How about the code when the ball is retracted and returned to its original position?
Oculus Go - How to disable cardboard splash screen?
Anyone have any Improvements?
Parsing Data in Processing thru Serial Port from Arduino + Pixy Cam
Inheritance override draw()
I need help morphing two jpg images
Circle will become larger when mouse moves on it (loop question)
Shooting in a game
Tracking ball task with smooth curve
Ship fly through the gate (asteroids game)
Badly formed character constant
I want to know how this is expressed. 02
selectOutput feature
I want to know how this is expressed
mousePressed always true
Engg 233 final project
Final Project Engg 233
Processing program using OSC messages
Adding parent class to arraylist with internal function
Arraylist containing x sounds—How?
Issues with sound output
Have an error when using OpenCV
Sprites animation that use a lot of memory
Moving a molecule up and down
Ball on platforms [School project]
How can I make a program that hits balls in processing?
Animated Text p5
Help with placing a shape on grid for tic tac toe. My code is shown below
Help with placing a shape on grid for tic tac toe. My code is shown below
Could processing run on macbook m1?
How to extract values from a PVector?
Expecting EOF, found else
How do i add colour to each one of the 10 boxes i made
Drawing a spectogram 2D (or 3D) from a recorded audio
Connect USB webcam to Processing Android with Ketai
G4P library with GUI builder - Can I make Sliders in an Child applet?
Exported Linux app can't see its images when launched from AUTOSTART
How to set random colors
Independently translate and rotate
Drawing atomic orbitals
How to make clone stamp tool as the photoshop?
Virtual Piano Help ASAP

2 posts were split to a new topic: Text covered by an image