Skip to content
loading...

Static Typing: a Personal Journey

Ben Makuh on December 21, 2017

Last February my company sent me to the Colorado School of Mines, my alma mater, to recruit computer science grads. Many of my former classmates we... [Read Full]
markdown guide
 

Nice post! Coming from a java background, I felt the same way when I started writing javascript.
Type safety is like writing code which already has a bunch of tests for the types, or in other words, we do not need to write tests that the compiler can do for us.

 

Thanks for writing this. I really loved the article and to be honest your journey makes perfect sense. Whilst I've been an on / off developer for some years amongst other jobs I've spent a lot of time around Javascript and you are right, there is definitely something good to be said about static typing. At first, the flexibility and love you get from the lack of constraints are brilliant, but I have been hit so many times with silly little errors which something like typescript could have picked up earlier.

As you have mentioned, it's horrible to feel as though you are going through the motions just to satisfy a higher level of automation. However, when working on large projects I think I've started to feel the itch in my brain saying "god this would have been perfect to start trying static typing". Let's face reality, we are clever folks being in development work. It's the engineering, mathematical and creative parts of your brain firing off constantly as you develop your code. It's the most fulfilling job anyone could do (in my opinion!), there's a great level of satisfaction from making things just "work". However, we are human and whilst the brain is a brilliant component we can only utilise a small percentage of that to keep track of everything we develop. It would be naive to believe that you can remember every facet of your code and ever use case that could run through your functions. For me, this is why static typing really offers benefit.

Automation is augmenting my skills, it is not blindly replacing gaps in my knowledge. I knew I needed to assign a variable or add a parameter when I was writing my function out, but can I be damned if I remember that fact 2 years later when building on top of my old application!

As mentioned - I'm yet to dive into javascript static typing, but I've used it in other languages. Heck even VBA forced static typing. Your post has just prompted me to re-ignite my interest and I think for 2018, this goes on my to-do list.

 

Wow, this makes my day! I love that it inspires you to try it out!

 

One of the things you have to get used to with Elm is the compiler. Most of the time, if it compiles, it will not crash. So, the compiler catches (and therefore complains) a lot, moreso than most other compiled languages. The compiler errors have to become less of a smack on the head and more of a TODO list. This makes refactors really nice. Change stuff, then fix all the items the compiler complains about, and you can be reasonably sure it all still works.

 

That's a great way to frame it. Viewing it as a TODO list makes it feel much more helpful than like something you have to fight.

 

A really well thought out post. My first language is C# so I'm used to static typing. If I ever need to do extensive JS work I'll be sure to check out some of the tools you mentioned!

 

Thanks for the encouragement! If you're used to C#, TS will feel fairly familiar to you. Microsoft definitely patterned the language pretty closely on C#.

 

In fact both languages were created by the same person, Anders Hejlsberg.

code of conduct - report abuse