Static vs dynamic typing

A Large-Scale Study of Programming Languages and Code Quality in GitHub (2017-10-22)

that static typing is better than dynamic;

In general I prefer static typing - but I’ve noticed there seems to be a growing segment in the industry:

  • who will not consider any language which isn’t statically typed
  • don’t scrutinize the actual quality of the type system that is enforced
  • derive a false sense of security from code compiling without errors - to the point that they get sloppy with their automated tests

“static typing” can be a useful tool in your toolbelt and it may even be desirable but I don’t think it’s necessary in all situations.

Anyone who believes that static typing is necessary would have to dismiss languages like Erlang and Elixir out of hand and miss out on some other opportunities.

Beginning of the year Robert C. Martin’s Dark Path contemplated the rigidity that some static type systems can impose on an implementation - and received a lot of criticsm.

In Types are like the Weather, Type Systems are like Weathermen Matthias Felleisen discusses the hybrid approach of “gradual typing” where early on a system can be dynamically typed but eventually types can be introduced into the portions that are stable and well explored (i.e. well known). But he is also very clear that the presence of any dynamically typed code has a significant impact on the “type safety” of the overall product.

Neither “dynamically typed” nor “statically typed” dogmatism is helpful (dogmatism never is).

5 Likes