4 ms·
composition over inheritance... Its the fragility of large inheritance hierarchies. They work well for very rigidly defined real world structures but not so we
by TickleSteve 5y ago
composition over inheritance...
Its the fragility of large inheritance hierarchies. They work well for very rigidly defined real world structures but not so well in most real-world usages.
- h0l0cube 5y agoI came to the comments to say exactly this. I think like any ideological stance, it's extreme and there are exceptions to the rule, but for games it's great for a lot of reasons. Tarn was wrong about this though: > Using a single object with different allocated subobjects is almost certainly worse for cache misses It depends a little on the context, but having object pools is exactly the right thing to do when you're trying to scale. It allows you to group together similar data, reducing cache misses when batch processing. You can even cache-align your primitives, or even run SIMD and multi-core jobs to batch update an entire set of attributes that belong to multiple objects.