Friday 23 May 2014

The ergonomics of a statically typed language

Moving from a statically typed language like java on the backend to a dynamically typed language presents its own set of challenges, there are new paradigms to master and habits to unlearn become effective in the new language.

One unexpected outcome is the shift in ergonomics. Simply put in dynamically typed language you need to type more code because you can't lean as much on the ide to figure out what you want to do and give you all boiler plate code with a few well placed keystrokes. Intellij is great ide, webstorm is a great ide derived from it, but it is inherently less capable as an ide on its own due to not being able to assume as much about what your intention is when you are coding.

Statically typed languages are easier to predict intention from due to the strict rules from the compiler, dynamic languages are a lot looser allowing you to do your own thing at  pretty much any time so the ide has less opportunities to be smart and complete what you are doing for you. Thankfully the amount of boiler plate code you have to write is pretty small in javascript and you really save a lot in not having to do alot of marshalling code when you couple node and mongo together and go JSON all the way through. You do however have to write alot of code with very little smart code completion and more complex refactoring like extracting methods is spotty at best.

This realisation makes the editors of choice for dynamically typed languages easier to understand, if the ide doesn't give you that much benefit then you may well be better off going with something that exists everywhere like vim or emacsso you can learn once and code everywhere but holding that many keystrokes in the fingertips is a long journey, that sometimes feels like a backward step.

It would be great to see an emperical study of the amount of typing required by two pro users across dynamic and statically typed languages, but my own anecdotal evidence has me typing alot more, but also looking for more ways to optimise input which is an interesting project in itself.

No comments:

Post a Comment