top of page

ICM Entry # 5 Refactoring

  • Writer: Ibrahim Hashmat
    Ibrahim Hashmat
  • Oct 9, 2020
  • 1 min read

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.

Recent Posts

See All

Comments


Post: Blog2_Post

©2020 by Ibrahim's Blog. Proudly created with Wix.com

bottom of page