Since the advent of dynamic programming languages, there has been ongoing debate about which language paradigm; statically-typed or dynamically-typed is better in terms of developer productivity.
If you asked developers to share their opinions on the subject, you would probably get a wide range of conflicting answers; each of which would typically be biased in one direction or another depending on the developer’s area of expertise (and a lack of understanding of the alternative).
Having gone back and forth between statically-typed and dynamically-typed languages several times in my career, I hope that I’m qualified to make this list of pros and cons:
It’s easier to find things. For any variable or function, you can easily jump to its class definition without leaving the IDE and without having to know anything about the directory structure of the project. Conversely, for any class or function definition, you can easily and unambiguouslysee where that class or function is used in your code and jump to it without leaving the IDE. (Statically typed languages make it easier for IDEs to do this).
10
with the string “8” and you would get the string “108” as a result instead of the number 18
that you were expecting.myVariable
of type ClassA
and trying to assign to it an instance of ClassB
(type mismatch; even if they have the exact same interface)— These kinds of errors are often easy to resolve but cumulatively, they still take up a fair amount of developer time. Semantic errors are the obvious, silly kinds of errors that make you blame yourself for not adhering to the compiler’s stringent needs. For example in a dynamically-typed language something like if (1) { ... }
is usually OK, but the compiler of some statically typed languages will throw an error because 1 is not a Boolean.Based on this list, it’s easy to see why developers are so divided on the subject. Ultimately, it comes down to personal preference and the kinds of tools that you like to use.
Personally, I have a preference for dynamically typed languages because I hate to wait for the compiler when I’m debugging. Maybe this is related to my particular debugging style; either way, it’s the point that has the biggest impact on my productivity. I do miss not being able to jump around different parts of my code by clicking on stuff but I compensate for it by organising my code into logical directories and by naming my classes/objects/variables appropriately — Then I can find them using text-search.
That said, I don’t think the difference in productivity between the two paradigms is too significant and it probably varies from developer to developer. You’ll always be more productive when coding in a language that you enjoy.