Home › Per Nystrom (Component pattern), a single GameOb…
Per Nystrom (Component pattern), a single GameObject often AGGREGATES many components for which reason?
AFavour composition over inheritance
BSpeed of OOP inheritance is too slow
CComponents are required by C++ standard
DTo avoid garbage collection
Answer & Solution
Correct answer: A. Favour composition over inheritance
Nystrom Ch. Component: behaviour is split into reusable components (Transform, Renderer, Collider, AI) instead of a deep class hierarchy.
Related questions
Per Nystrom (Singleton chapter), Nystrom's view of the Singleton pattern in games is best Per Nystrom (Service Locator), the Service Locator pattern provides which feature?Per Nystrom (Spatial Partition), structures like quadtrees / BVH speed up which game operaPer Nystrom (Event Queue), queueing events between producer and consumer DECOUPLES them inPer Nystrom (Double Buffer), separating current vs next-frame state prevents which artifacPer Nystrom (Object Pool), reusing pre-allocated objects instead of new/delete each frame Per Nystrom (State pattern), modelling a character with 'standing', 'jumping', 'ducking' bPer Nystrom (Command pattern), a 'Command' object typically does which?