Does JavaScript Make Developers Love Static Typing?

Many developers swear by statically typed languages such as C#, Java, C++, Go, Swift and Rust. Could experience with JavaScript be a reason for this?

Erik Engheim
6 min readJan 19, 2022

--

I am generally a big fan of dynamically typed languages, or at least so I thought. In fact I have written a number of stories praising the virtues of dynamic typing:

However, as I have been spending time getting to grips with JavaScript I am desperately starting to wish I had proper types. That has made me reflect on the advantages and disadvantages of static typing in different contexts.

Let me give some background. My favorite language is Julia, which is dynamically typed. When I write Julia code, I tend to follow a REPL based approach. For those unfamiliar with REPL based development I tried to give readers an idea: Test-Driven vs REPL-Driven Development.

Using Julia has influenced a lot of what I think about software development. However what gives a certain blindspot is that I have not used Julia to develop GUIs. When writing Julia code I am generally able to write separate functions which I can test out immediately in the Julia REPL with different input data. This gives the ability to narrow down what you are testing and discover problems quickly.

GUI code tends to be very different to work with. It is event based and there tends to be complex update mechanisms which means you can end up with complex and intricate flow of control.

While working with JavaScript code I would find time and again that I had called some function with the wrong type of arguments or wrong number of arguments. Sometimes I had misunderstood some API. Testing APIs used in a GUI setting to grasp properly how they work is very cumbersome. Testing the API of a dictionary or array is very easy in a REPL. You can quickly determine what different methods do. That is not the case with GUI related APIs. They require a lot more setup to work.

--

--

Erik Engheim

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.