Statically typed languages
So, why the change? Statically typed languages can bring a number of benefits. Types take what used to be implicit in a dynamic language and make it explicit in a statically typed one. They help document intent, and in many cases can replace entire classes of manually written tests that may have previously been needed to ensure the same level of quality in a dynamic language.
Certain statically typed languages are able to analyse the program and make sure it’s ‘correct’ and cannot fail at runtime in an unexpected way. Some statically typed languages also enable tools to fill in gaps and suggest how to complete the jigsaw of a program, increasing programmer efficiency while maintaining correctness of code. Some tools can even optimise code performance based on the types, resulting in a better performing program.
With these benefits, why would you ever use dynamic languages? Depending on the use case, you might be willing to trade off correctness for being able to rapidly prototype an idea without thinking of every single eventuality. In these instances, a dynamic language may actually be a better fit to avoid jumping through unnecessary hoops to solve a problem. Switching to statically typed languages will also likely demand a different approach to the code itself. Patterns that the programmer may not be familiar with are used to ensure the code will pass static analysis and subsequently compile.
For code that you want to deploy to production, which needs to be reliable, the explicit statement of intent that’s verified at build time is super-beneficial. This, paired with the guarantee that what is written won’t fail at runtime, makes statically typed languages a great choice for production applications.