The problem with statically typed languages is that you tend to spend an enormous amount of time finding out what type of variable you've used somewhere in your code.
For me dynamic typed code works best, I just write variable and function names that are self explanatory.
The problem with statically-typed languages is that you tend to spend an enormous amount of time finding out what type of variable you've used somewhere in your code.
Why would you do that ? Given that is statically-typed language the compiler and the editor have the info of the variable type in the moment that you are programming.
They can not do that in a dynamically-typed language without stuff like the one described in this article, or something like the method documentations.
By the way, we can think about this like another way to document the method parameters and result.
I guess it is like this:
statically-typed language: You spent more time selecting the types to define / choose in every context.
dynamically-typed language: You spent more time guessing the types when you are using it.
Take this example:
You are going to use a python function called compute for the first time.
defcompute(foo,bar):# .... 20 lines here
If the method has no documentation string, you need to read the documentation or read the code to infer the type.
Actually, when the language had type inferences, it gets a lot easier and the intent is almost always made clear with type annotations. Haskell is a prime example of how easy it is to use the type system to guide program correctness. Oh, And the thing can look like a dynamically typed language because of the inference engine doing most of the heavy lifting for you.
The problem with statically typed languages is that you tend to spend an enormous amount of time finding out what type of variable you've used somewhere in your code.
For me dynamic typed code works best, I just write variable and function names that are self explanatory.
greetingString = "Hello World!";
Not if you are coding in C#.
var
keyword does all the heavy lifting for you and you still have all the good compile-time safety.Why would you do that ? Given that is statically-typed language the compiler and the editor have the info of the variable type in the moment that you are programming.
They can not do that in a dynamically-typed language without stuff like the one described in this article, or something like the method documentations.
By the way, we can think about this like another way to document the method parameters and result.
I guess it is like this:
statically-typed language: You spent more time selecting the types to define / choose in every context.
dynamically-typed language: You spent more time guessing the types when you are using it.
Take this example:
You are going to use a python function called compute for the first time.
If the method has no documentation string, you need to read the documentation or read the code to infer the type.
Actually, when the language had type inferences, it gets a lot easier and the intent is almost always made clear with type annotations. Haskell is a prime example of how easy it is to use the type system to guide program correctness. Oh, And the thing can look like a dynamically typed language because of the inference engine doing most of the heavy lifting for you.
A pinch of JavaScript camel-case in Python.
Humans are messy !! but that's how they keep themselves evolving