Making A Modular Design
The importance of a modular design for your applications
There are a lot of things that help when coding your next project, but none seem as important as readability and modularity. You don’t want to throw all you logic into one place. Being able to create reusable modules throughout your project allows for rapid expansion and easier maintainability.
Obviously the code above can be pushed even further to create a more modular design. But in the player class itself, you can see there is a modular design that is being implemented and other classes can interact with it as well.
Creating a bunch of smaller components rather than stuffing all functions into one containing code block is much more efficient and readable.