Why does Types matter in programming
Possibilities
Typing happens on two axis, there is the dynamic vs static, and then there is the strong vs weak.
If you program in python you are programming with strong typing, which is good, but you are also using dynamic which might be a little annoying.
Dynamic or Static
This is a binary there is no degree to which it is dynamic, either you are or you aren't.
The way this works is if you happen to be in a dynamic language and you want a variable
This example would be in Python
a = 1
There is not a type in sight, but it is still strongly typed.
The next example I will be presenting is in Java
Int a = 1;
That is not so bad, but it can get really bad with the Types, that is clearly worse, but there is a clever solution to this problem, meet Haskell which is probably the programming language with the strongest typing and also with static typing.
In Haskell to declare something to be Int as the two examples above
a = 1
But wait why is there no declaration ?
Simple Haskell has Type-Inference meaning it can infer the type of code typed in, but good style of the above code would be
a :: Int
a = 1
where :: means has type, basically the compiler takes all your Type Declarations and throw them out, then it figures out the types for itself and sees if you are right.
Dynamic typing is the computing tacking a value with the type onto a thing, probably coming from the value you used as input, the statically typing require you to give types, or have a type inference work it out for you.
Strong vs Weak Typing
Strong vs Weak Typing is not a binary, it can be in between, Haskell would be one of the most strongly typed languages, and on the other side something like Javascript would be one of the most weakly typed languages.
To investigate how strong typing helps programmers the following snippet
"a" + 1
would be handled very differently in different languages.
Javascript

credit
would think nothing of this and give you the obvious answer a1
Python

[credit](http://python.org
Python is strongly typed dynamically, so python would yield a run-time error here
Haskell

credit
Haskell being both statically typed and strongly typed would yield a compile-time error,
this would be the ideal situation you get the error before even running the code. That way no buggy can possibly run in production.
C

credit
C really has weird ideas about how to coerce types, the weirdest happens when you do something a little different
"hello" - 1
here C does the obvious thing and returns
"hell"
well wasn't that what you wanted ?
Well kidding aside, this type coercion is a big problem when weak typing is used.
Great topic, iobates!
:)
I just started a series on Idris, which you may call the dependently typed version of Haskell:
https://steemit.com/programming/@qed/type-driven-development-idris-1
Keep up the good work!
Yeah Idris is one of the cool things Haskellers look at, possibly like other people look at Haskell, a yet more expressive type system, I should have a look at that post, I might learn something I can use :-P
Very nice explanation. Cool that you compared different languages. I recently wrote about type coercion and precise comparisons in JavaScript. Those are some very complex concepts to wrap your head around.
Javascript has some really weird behavior, it is not a good sign when you can make the language give different answers depending on how you ask.
True. But I still love it. :)
Just remember to turn on strict mode.
Definitely! Luckily, nowadays I mostly write ES6 with Nodejs.
Yeah, nodejs could be fairly useful when you get the new features of javascript, I just found it to be pretty broken with libraries that dont work so well together since different libraries depend on different versions of nodejs.
Agreed. Thankfully, everything works like a charm out of the box now with Node's latest version 8.
This is good material, there are so many so called programmers nowadays that don't understand these aspects and they end up with code that looks like it's working but it's producing garbage data.
Good tut, I'm subscribing to this material :)
Nice, perhaps I should write something else like this.