Object Dancers

Link: https://editor.p5js.org/valerynfang/sketches/RQO-MqF5R

A benefit for using class is to repeat same code easily. For example to display another dancer, all the coder has to do is to type dancer.display(). The benefit of my class not relying on any code outside of its own definition is that there is no need to worry to apply to a different set of codes. The class allows it to apply specific commands to only the class dancer. Not only that you could make different updates and let a random function choose what your dancer gets to do. Another idea is to display same dancer but make them have different dance moves by creating two different updates. Not only that, people can copy and paste your class their code and gather different dancer so it is much easier to collaborate with other programmers. It is challenging in a way that you have to ensure that my dancer does not have the exact same dance move with a different programmer’s dancer. 

The dictionary meaning of modularity is when modules can be removed, replaced, or upgraded without affecting other components. In terms if classes, the display and update allows the dancer to be easily updated and be constantly updating. In the class function, anything inside the curly bracket is only applied to the code within the curly bracket. For reusability, the display and update can be repeatedly used as much as you want which means that the code is reusable 

 

Leave a Reply

Your email address will not be published. Required fields are marked *