Why is dynamic typing so popular?
I have worked with a couple of statically typed languages and a few dynamically typed languages. I have noticed that when using statically typed languages I get all kinds of IDE support. That IDE support makes me really productive. It also really helps me to move stuff around without breaking things too badly (i.e. refactoring). Tests also help with ensuring that I didn’t break things. Compile times are usually sub-second due to partial compilation. Auto complete allows me reduce typing down to a two or three keystrokes per identifier (e.g. class name, variable name). Documentation and type info for the method or variable often pops-up automatically. This allows me to stay focused in the IDE.
Conversely, the more dynamically typed the language is, the less I am using an IDE and the more I am using a text editor. Of course, my productivity plummets at that point. Refactoring becomes more difficult and more (completely) reliant on unit tests to ensure they are done properly. It’s not a perfect world. Sometimes unit tests are not as complete as I want them to be on legacy systems.
Refactoring via grepping is a joke, time consuming, labor intensive, inefficient, and very error prone. However, refactoring is something many developers do allot of.
Dynamic code is probably always going to be at some sort of disadvantage speed-wise because it is dynamic.
I have to refer to documentation more to determine which methods are available. If a class doesn’t have documentation, then I have to open the code file for it and scan through it. Sometimes, projects will have hundreds or thousands of code files. Obviously I am not going to memorize all of the available functions and method signatures in every code file in a project, or the standard library for that matter. Therefore, I am constantly opening and closing code files and documentation pages. Sometimes it isn’t obvious where the code lives. In that case, I have to grep every file in a project for a function name. Sometimes function/method names are not very specific leading to dozens and dozens of false positives.
I can think of lots of pros for statically typed languages and none for dynamically typed. What am I missing? Why are people even still debating the merits of dynamic typing?