Monday, 26th February 2018
By far the most important lesson I took out of this game is that whenever there’s behavior that needs to be repeated around to multiple types of entities, it’s better to default to copypasting it than to abstracting/generalizing it too early.
This is a very very hard thing to do in practice. As programmers we’re sort of wired to see repetition and want to get rid of it as fast as possible, but I’ve found that that impulse generally creates more problems than it solves. The main problem it creates is that early generalizations are often wrong, and when a generalization is wrong it ossifies the structure of the code around it in a way that is harder to fix and change than if it wasn’t there in the first place.