DEV Community

Discussion on: Why learn... a statically typed language?

Collapse
 
cesee profile image
Cesar Maroun • Edited

Nice article.

I think it should be very obvious to any programmer that the benefits of static typing and compilation outweigh greatly the inconveniences resulting from the laziness we all have.

After all, how often do you ever want to assign a number to a variable and then assign a list of strings to the same variable? Or why wouldn't want to get an error before it happens live ? Then again, it must be for the same reason some developers do strange things like not throw an exception when something unexpected happens (I don't understand that logic either).

TypeScript - for example - gave super powers to javascript and coding is suddenly fun and productive.

TypeScript gives back the security that you lost in javascript where every tiny mistake can make you waste many hours if your application is more than a few hundred lines of code. It is a great example of why static typing and compilation is a must for every good code base.
Of course TypeScript added many other things like easier inheritance which contributed to much better code, but enforcement of type checking and compilation were a huge improvement for the whole team.