Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
It's not gonna fix all bugs, but it does making programming life a lot easier. For example when you are using APIs which contain typos like (payed instead of paid). I would never want to use that without types things.
Those two ensures that it's less dependant to human.
Dynamic types are as reliable as human, and I would not say human is reliable at all.
Also for functional, it's easier to test so it relies less to human.
Nowadays more and more "big" it companies pop up but it doesn't make human anymore reliable. So for companies it's easier to take development to direction where it's less error prone to ensure quality. This is also part of the reason how consumers have changed, it's not that rare to hear, or say "it's already 3th millennia and they can't get this to work". So easiest way is to go to direction where those errors and things are easier to catch. And it's bad for business if even one bug appears in software, that can cost in worst case more than company can pay, until they are in size of google or whatever.
theuser51851yStrict typing can also aid in documenting the data flow, although that may also be an excuse to not document at all. In the contex of web development, I see a lot of applications thay suffers from not being documented.
Dynamic typing isn't popular because it "fixes" strict typing. It's popular because it reduces time-to-market.
I think both have their place. Static typing is useful for a lot of reasons (mostly relating to error-checking), but I recently wrote a function that takes arbitrary JSON as input and parses it, and that was not fun to do with static types.
Ubbe11961y@Lor-inc exactly. I am not arguing that there is anything wrong with strict typing. For some tasks it is definitely better. For some it might not be.
Your third sentence would benefit from strict typing.
I'm actually gonna say that strict typing (or rather strong typing) with type inference is objectively better than dynamic typing.
Dynamic typing doesn't remove types, they still exist. You just lose control over them. This makes it way less apparant what your data is (or is supposed to be!), which is laborious and leads to bugs. It's also no faster to type than strong typing with type inference (for local variables which is the only acceptable place for slight ambiguity anyways)
Loose typing (duck typing) which often goes along with dynamic typing also interferes with your ability to properly define your architecture:
What do you do with a Rect class that takes to parameters, width and height. Now you have to check yourself to only allow numbers (which is way more boilerplate than type hints) or you're gonna have a problem when you call area() because oh no you get a runtime exception as strings don't make any sense in this context
Types don't help the computer, they help you