General guidance on idiomatic code for beginners

Hello everyone! I have a question regarding the code of a sketch, but it’s not a specific question, so I did not post it at the coding category. I finished a sketch recently and it looks like this:

The code is here:

My question, or concern, is this: I feel like there are a lot of error traps in my code. Let me explain a little.

The sketch basically divides the canvas by drawing a line. Once it collides with the screen, it changes axis and finds a new random point to begin dividing. This repeats indefinitely.

I have zero-programming experience, am actually a musician (hence the user name), but after trying out Processing and P5 3 months ago, I could not stop doing it! I am coming to a point where I feel more daring to try more complicated programming ideas, but I don’t know where to start.

Speaking for many beginners trying to become more adept, what are some of the best resources or ways to become better at creative coding?

I took a look at Fal-Works github and found this :

It looks to me like there many ways to ‘draw a line’ in processing. Where does one start to understand these things, as a non-programmer?

I know my question is kind of convoluted and not very concise, but I just want to start a dialogue. So thanks for reading until here!

1 Like

I think you’ve made a good start, coding isn’t something that most will excel at straight away and requires some foundational understanding about code structure and language logic. The best way to become better at coding is honestly to just explore different problems, tackle different design challenges and eventually you’ll come to understand the block of code which a shared amongst different sketches, or how to approach a particular problem.

I like open processing because it showcases other peoples ideas and lets you dive straight into their code, I do believe they have a tutorial mode too for those who are so inclined. Otherwise as always i would probably recommend Daniel Schiffman’s channel on youtube, who provides great introductory courses into programming but also lots of high level resources too, his videos are aimed at creative coders too, so look forward to drawing trees, fractals, flocks, etc etc.

As for your code it seems to work fine, however the only thing I’ve noticed is that some areas seem to have a lot more lines than others, which might suggest that its not choosing positions completely randomly.

As you are a musician you might also want to take a look at some of the audio libraries available in processing, which many people make use of and allows people to produce things like visualisers or generative music etc.


Also, there are over 150 easy lessons which teach the fundamentals of programming at They include lessons learning SuperCollider which is, if you don’t know already, a system for audio and algorithmic composition.


I am an artist/designer new to coding as well.

I agree with the responders above.

Dan Shiffman’s videos on youtube are great!!!. Look for the playlist on his channel: Learning Processing: A Beginner’s Guide to Programming Images, Animation and Interaction.
This follows along with his book of the same name. The book is EXCELLENT too.

I have also found the tutorials by Abe Pazos on youtube to be VERY HELPFUL as well. Look for the playlist Fun Programming. These are the same videos as on his site as noted in previous comment.

Also, any coding questions I have asked in this forum have been answered with great clariity.