← Back to context

Comment by BoorishBears

6 hours ago

Without agreeing (or disagreeing) with their larger point, dynamic types become more of liability as a project gets larger

Like "schemaless" database applications, there's always types/schema somewhere: the choice is if they'll be explicitly defined at the place of construction, or implicitly spread out across all the places data happens to flow in your application. And the more places there are, the more spread out they'll be.

Static typing is also really nice for game dev since proper unit tests are harder (but not impossible) compared to your average CRUD app.

The other side of the argument is that dynamic typing is great for prototyping and can allow for more compact code.

The discussion is exhausting because many people don't understand the difference between weak typing and dynamic typing. You basically never want weak typing but dynamic typing has legit uses. Yes JS is both weakly and dynamically typed and that sucks but Common Lisp shows you can have very strong typing and dynamic types.

Lots of very complex software has been writing in dynamically typed languages. The whole Erlang/Elixir world is dynamically typed though Elixir is getting gradual typing.

There is a good reason gradual typing is getting popular, you get the best of both world. You can prototype quickly and then add types and make everything more solid later.

(Which also why you want to always use a statically typed language in the corporate world because there is never a "later" and the bigger the team the more important it is to have the lang enforcing discipline. But not every programming is corporate.)

People that are dogmatic about static typing show their immaturity. The older I get the more I realize that there is no right or wrong way to program, everything it tradeoffs and "it depends".

  • Exactly which part of my comment seems dogmatic?

    You literally start your comment by reaffirming my point (prototyping, like when you tend to have a smaller code base?)

    Feels like you replied to a comment you imagined based on past interactions, not anything I actually wrote.

    • > Exactly which part of my comment seems dogmatic

      I never said that any part of your comment is dogmatic. This is not private conversation where I am talking to you directly.

      I wrote

      > People that are dogmatic about static typing show their immaturity

      Referring to the people like eatsyourtacos who started this discussion.

> dynamic types become more of liability as a project gets larger

Why?

  • > there's always types/schema somewhere: the choice is if they'll be explicitly defined at the place of construction, or implicitly spread out across all the places data happens to flow in your application.

    > And the more places there are, the more spread out they'll be.

    • You can still have schema validation at the borders of the application(data in/out) without static typing.

      I think there are many other factors that come into play when it comes to maintaniblity of large projects. I'd easily choose to maintain a large Elixir or Common Lisp codebase over a Java one, assuming they were all using the Best Practices™ of their respective languages.

      There is research out there, and there is absolutely zero evidence that static typing catches more bugs than dynamic types. My experience is that immutability, functional programming, simplicity and testing pays a MUCH bigger role in maintainability than static typing.

      Dynamic typing has trade-offs, and so does static typing, HUGE trade-offs by the way. But for some reason, no one seems to mention them... ever.

      1 reply →