Hacker News new | ask | show | jobs
by inigyou 1 day ago
OOP can be convenient for prototyping a game because you can just write new stuff at high velocity like "yeah a cow is a pig but it's brown and drops leather, a skeleton is a zombie that shoots arrows, and a client is just a server with graphics". Figuring out the right decomposition right from the start can be harder.
1 comments

It is usually possible to design a representation where cows and pigs are the same thing, either Animal class instances or equally unified other data structures, and their differences are data (e.g. weight, length, one of several colour patterns).