3 ms·
Static typing is an additional contract on the behavior of the code, similar to unit tests but built into the language itself and therefore cheaper to write. Th
by Joeri 13y ago
Static typing is an additional contract on the behavior of the code, similar to unit tests but built into the language itself and therefore cheaper to write. The overhead of specifying types slows you down during initial coding, but the code that results is more reliable and easier to read and maintain.
In environments where initial coding speed matters more than long term efficiency dynamic typing is preferable. Prototyping, mvp's, these are things that fit well into a loosely typed language. When that MVP grows into a business however, eventually it becomes benefecial to switch to static typing. Performance of a feature is usually the leverage that makes it happen, but the reduced cost of maintenance is what makes it stick.
So, both choices can be right for the same team at different stages of the product lifecycle.
What is interesting about Scala, go and rust is that they try to reduce the coding cost of static typing as much as possible (compared to Java, c and c++), giving the benefits without costing as much up front.