Alright I have improved the code for my Futbol project. This project focused a lot on organization of a very basic ruby app. I learned a ton about modules and inheritance and when it is appropriate to apply one over the other.
I knew that the main difference is instantiation. A module does NOT need an object to be instantiated in order to use it. We are able to use them anywhere as long as the class has the module include
syntax. This was helpful in this project for organization.
I didn't need to instantiate team_statistics
objects in my opinion. I just wanted to be able to manage the behavior of the stat_tracker.
Inheritance modifies the attributes of an object. The best way to explain this is the you can inherit your parents eye color. On the other hand if you mom went to see Boys II Men at 16. Just because your mother is your parent doesn't guarantee that you will also go to see Boys II Men at 16.
This is an important distinction when we are trying to decide how to organize our code.
Top comments (0)