The Entity Component System design pattern
The model that we are going to implement for our game objects is typically referred to as the Entity Component System, which is a pattern that uses composition over inheritance to manage the game objects. The entity defined in ECS is a general purpose object that contains some unique ID and is a container for all the components. The component defined in ECS determines how the entity interacts with the world and owns its own domain, such as physics, graphic updates, or input handling. Finally, the system defined in ECS determines how the entity and its constituent components get updated throughout the lifetime of the game. As a quick note, this pattern is discussed in much more detail in Game Programming Patterns by Robert Nystrom under the Component chapter.
Like most design decisions in software development, the ECS model doesn't come without its own host of tradeoffs. One issue is since these entities are now composed of different components...