top of page
  • Writer's pictureIbrahim Hashmat

ICM Entry # 5 Refactoring

Last week we learnt about refactoring our code, essentially making it legible and more accessible. For my assignment I refactorized my old "Doodle' sketch from the beginning of the semester.


I made some parts of my drawing like some of the lines and an ellipse into objects just to see how the code would look, and it made the overall code have a better flow to it. I changed the rest of the elements into functions so that I could use them in other sketches in the future.

code showing how I converted my elements into objects in p5js
Object code

Line now uses the values that are within the object code
Elements now as separate functions


Each function running in Draw

Refactoring makes a lot of difference how a piece of code looks. Compared to how the initial code(my Doodle sketch that I mentioned above) looked like, this new code is more readable and easy on the eyes.

3 views0 comments

Recent Posts

See All

ICM Media Entry#5 Markov Chains and Text

The prompt for this week felt very open ended (more so than usual) and I felt like I should try something completely different to what we did in class, so I picked Markov chains. For my assignment thi

Post: Blog2_Post
bottom of page