3 ms·
I like a lot of Muratori’s writing but… is it really wise to take code architecture tips from game devs, of all people? I’m willing to trade lots of performance
by xmcqdpt2 2y ago
I like a lot of Muratori’s writing but… is it really wise to take code architecture tips from game devs, of all people? I’m willing to trade lots of performance in exchange of extensibility and stability over the long term.
I’m not a huge fan of overwrought OOP either, but modeling everything with scalars and comments makes it sometimes harder to add new behaviours.
I’m also not a fan of video content, here is a transcript of the above video,
https://www.computerenhance.com/p/clean-code-horrible-performance https://www.computerenhance.com/p/clean-code-horrible-perfor...
If you look at the “not clean” code in the above, it’s fine, it’s still relatively easy to follow etc. Now think about extending it so that some shapes are the result of summing multiple sub-shapes, like a general polygon tiled out of triangles. That’s straightforward in the OOP case, but not so much in the flattened array case, and means that we need to reintroduce pointer indirections if we don’t want our shape union to be as large as our biggest shape etc. (I still might use a switch statement over inheritance.)