This week, I learned the idea of Object-Oriented Programming (OOP) from Dan Shiffman’s tutorials. Using class, I rewrote one of the codes from last week, without any change for end-users.
The one I rewrote –
I chose this one because there were 4 repetitive for() loops in the code. I remember that last week I tried to write these in nested loops, but I couldn’t manage to separate each group of lines. However, this week, making each group into an object, the variables in an object won’t be affected by each other, which makes the whole difference and turned out well.


The transfers happening between class, constructor, and parameters are still not so intuitive to me though, so I tried to create another sketch base on these concepts.
05.01
05.02