It's kinda cute how people think strict typing is going to prevent bugs and make software reliable. It's all the rage now. I am not saying that there is anything wrong with strict typing but after all it was the original state of affairs and dynamically typed languages where developed to fix it.
Same hype with pure functional programming. It's going to push bugs out to the edges and make everything work. The pursuit of purity is no new thing and it breaks down on contact with the real world, such as a complex JSON. A switch to Haskell won't change that much. I have seen people hunt peculiar bugs in Haskell for ages.

  • 3
    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.
  • 4
    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.
  • 2
    Strict 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.
  • 2
    Dynamic typing isn't popular because it "fixes" strict typing. It's popular because it reduces time-to-market.
  • 1
    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.
  • 0
    @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.
  • 1
    Your third sentence would benefit from strict typing.
  • 3
    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
Add Comment