Can anyone provide some advantages and disadvantages each; static type checking and dynamic type checking?
Advantage of Dynamic Type Checking Dynamic type checking can find many errors that cannot be identified by static type checking. In most languages, static type checking is not possible for some language constructs in certain cases but the same purpose can be achieved by dynamic type checking.
Static checking: the bug is found automatically before the program even runs. Dynamic checking: the bug is found automatically when the code is executed. No checking: the language doesn't help you find the error at all.
First, dynamically-typed languages perform type checking at runtime, while statically typed languages perform type checking at compile time.
This question has been hit on a few times at SO:
What is the difference between statically typed and dynamically typed languages?
Dynamic type languages versus static type languages
Are dynamic languages slower than static languages?
Dynamically compiled language vs statically compiled language
Static typing has the following main benefits:
It allows statically (without running the program) detecting many programming errors quickly, reliably and automatically. This helps reduce the number of bugs and reduces the time spent on debugging. Type declarations serve as automatically-checked documentation. They make programs easier to understand and maintain. Static typing may improve runtime efficiency. (Note that the Alore runtime cannot currently take advantage of type declarations, but this will likely change in the future.) Dynamic typing has a different, complementary set of benefits:
Dynamic typing is conceptually simpler and easier to understand than static typing, especially when using powerful container types such as Alore arrays, tuples and maps. This effect is pronounced for non-expert programmers. Dynamic typing is more flexible. A static type system always restricts what can be conveniently expressed. Programming with a static type system often requires more design and implementation effort. Dynamic typing results in more compact programs, since it is more flexible and does not require types to be spelled out. The benefits of static typing are more pronounced for large and complex programs. It offers little benefit over dynamic typing when writing short scripts and prototypes, for example. In these cases it mainly slows down the programmer, and dynamic typing is preferable.
via: http://www.alorelang.org/doc/typeoverview.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With