![]() |
#1
|
|||
|
![]() If I am writing a piece of software and it is going to have many instances of a few different types of objects is it better to aggregate common/repetitive code for updates into a "manager" type class than having all that code replicated across hundreds or thousands of objects?
For example, if I have an object, say, a Collider and it contains a collision box and maybe a method for correcting position on collision, is it better to implement the code for detecting collisions within that object or within a separate CollisionManager class that could iterate over all active colliders to check for collisions? I wouldn't think it would make a difference either way for speed, but it seems liek it would use a lot less memory to house all the collision code in a single instance than duplicating it across many objects.
__________________
<Millenial Snowfkake Utopia>
| ||
|
|
|