Data-oriented design or why you might shoot yourself in the foot with OOP (2009)
There is some middle ground between data-oriented design and OOP: just organize your objects in such a way that:<p>a) objects of the same type occupy continuous blocks in memory,<p>b) messages are passed to objects of the same type, then to objects of another type etc.<p>In this way, you don&#x27;t lose the advantages of encapsulation, inheritance, polymorphism etc but you also don&#x27;t sacrifice cache coherence much.<p>OOP does not enforce a &#x27;random&#x27; memory access order, you can very will organize your objects in such a way that speed is not sacrificed much.