|
|
|
|
|
by dilipdasilva
400 days ago
|
|
Static typing lets you build very large rigid structures where types ensure constraints. However, these constraints get in the way of moving quickly. If you change a signature of a function, you have to first change every piece of code that calls the function. You then have to compile, restart your program, rebuild the whole rigid structure, and confirm the change works as expected. This whole process can take many minutes. The claim is that catching these errors at compile time results in more reliable code. Dynamic typing has no such constraints to help you catch errors at compile time. Dynamic typing allows you to build organic structures that more fluidly change. If you change a function signature, you don't have to change every piece of code that calls the function. You can change the function and test it in a running application without restarting the application. Doing this takes seconds. Dynamic typing allows you to iterate 100x faster. Being able to rapidly iterate often means better tested code and more reliable code. Both are valuable. Dynamic typing is valuable during development when you need to iterate rapidly and build a prototype when requirements are often changing. Static typing is valuable when code need is more mature, changing less frequently, and code needs to be put in production. Ideally you have both. More mature parts of the program are statically typed and more fluid parts of the program are dynamically typed. |
|
I strongly disagree that this sort of refactoring is "quicker" with dynamically typed languages, particularly with non-trivial (i.e. large) code bases.
You have zero feedback and no indication of how disruptive such a change is when working with a dynamically typed language. In fact, you have no feedback on whether you've actually finished the change at all.
While with static type checking, you have immediate and valuable feedback guiding you through such a change. Each line of code which requires updating is identified for you and communicated to you.