3 ms·
I've had several experiences where static typing forced my hand into making a software design decision which I later regretted. Many real-world entities don't
by jondubois 7y ago
I've had several experiences where static typing forced my hand into making a software design decision which I later regretted.
Many real-world entities don't have a fixed set of characteristics/properties; instead, they have fluid characteristics that can change over time.
Trying to model those entities using static types which have a fixed/static set of properties is a bad idea.
For example, in nature, a tadpole might grow arms and legs and become a frog. Trying to represent a single entity using two different classes 'Tadpole' and 'Frog' doesn't always work... What type is the creature if it's exactly halfway between being a Tadpole and a Frog? Do you keep inventing new discrete types to keep re-categorizing the creature as it grows or do you acknowledge that the exact type of this creature cannot be expressed discretely but that it lies on a continuum?
- anoncake 7y ago> What type is the creature if it's exactly halfway between being a Tadpole and a Frog? It's an animal. The type checker will make sure you don't try to water() it. Static typing does not have to mean infinitely granular typing (though of course typing everything "statically" as any is pointless).