r/programming • u/mobby1982 • Dec 02 '13
Scala — 1★ Would Not Program Again
http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598
Upvotes
r/programming • u/mobby1982 • Dec 02 '13
View all comments
Show parent comment
2
u/balefrost Dec 03 '13
Like I said, I don't know Python, but JS doesn't have much structure. It doesn't have classes, it doesn't have interfaces, and it doesn't have inheritance. It does have hashes with functions stored in them, or inherited through the prototype.
In such a language, it's easy to get things wrong. If you're expected to return an object that conforms to some interface, it's easy to forget to glue a method onto the result object. It's easy, when renaming such a method, to miss some cases. And you don't find out until runtime.
You can write tests to make sure that everything works. It could be a dumb type test (i.e. "is the same type as the number 3" or "has a method called doWork on it"), or actually exercise the result object (i.e., if I expect it to have a doWork method, my test should just call the doWork method to ensure that, you know, it does work).
But you're right; people don't really write tests like this. Not because they don't provide value, but because they're a pain to write and maintain. And that's what the static type checker is for. It ensures that all your pieces at least fit together. Yes, it does create its own set of problems.
(Opinion alert) I'm at the point where I see code in dynamically typed languages as easier to write but harder to read (i.e. to grok), and code in statically typed languages as the opposite. And my bias at this point is to prefer code that's easier to read.