Re:Game Development Essentials #1 - Don’t use inheritance fo...
by sixbrx on Tuesday February 07, 2012 @10:49AM
(#3562203)
It's also interesting that this Rectangle/Square conundrum disappears when you remove mutatable state from the picture. I think it's usually best to model mathematical objects like these as simple value objects anyway, it's less surprising and more similar to how they are treated within mathematics itself.
[ Parent
| on HN ]
Re:Game Development Essentials #1 - Don’t use inheritance fo...
by extension on Tuesday February 07, 2012 @12:59PM
(#3562892)
The conundrum is that you can't define a canonical inheritance relationship between square and rectangle or mammal and cat because the relationship depends entirely on how you are using these concepts in your program. Making them immutable may affect the relationship but does not make it canonical.