4 ms·
I think part of what you are not understanding is that it is not the plain ints or the strings, it's the structs or the classes or what have you, that you didn'
by olau 5y ago
I think part of what you are not understanding is that it is not the plain ints or the strings, it's the structs or the classes or what have you, that you didn't have to spec out beforehand. With rich but thinly-used data models in those line-of-business CRUD apps, the spec to usage ratio can approach 1:1.
With duck typing you just stuff the data in there and pick it out again.
I did not get it either until I had a couple of years of Python experience under my belt. And yes, you can do that in something like Java too, I'm sure. It's just not as convenient, and the culture will not tolerate it. And yes, there are downsides. (But there a downsides to the spec'ing too, one of them being proliferation of concepts, increasing the mental load of understanding the system.)
- tintt 5y agoThat’s a very good point. Also explains why Data Scientists like their dynamic languages, and Embedded engineers prefer static typing.
- StevePerkins 5y agoIf anyone really believes that an "Order" struct causes more "mental load", compared to passing around a tuple with a bunch of dollar amounts and random-looking strings, then I don't know what to tell them. The exact opposite seems obvious. I've never seen a Python codebase larger than 10,000 lines, that didn't require exhaustive archeology for newcomers to figure out the contracts. I'm sure that the original authors (who are always long gone) had fun, though.