P5 link: https://editor.p5js.org/ryrotella/sketches/j72_IfAwq
In this week’s Intro to Computational Media assignment, we learned the importance of refactoring code to make sure it’s clean and readable. I chose my assignment 2 p5 sketch, which looked like this in the code.



I went through and refactored the code into separate functions for each shape and clear comments. Here’s what it looks like now:





I got rid of all unused variables, separated functions out, and even added a mousePressed function to improve the interaction of changing an object’s size. The tidiness of the code makes me feel better. I noticed that in other people reviewing my code on the floor. The tidiness of the code made them feel more pleasant about my sketch.
I look forward to tidying my code and making my code a pleasurable read for anybody. I know I would have liked that in all the code I have had to review in the past.
Leave a comment