25 ms·
It's about the type system. Dynamic, weak typing makes writing static analysis/refactoring/etc tools extremely hard, but more importantly makes nearly any comp
by hamidpalo 14y ago
It's about the type system.
Dynamic, weak typing makes writing static analysis/refactoring/etc tools extremely hard, but more importantly makes nearly any compile-time guarantees impossible. Having your app crash because of a small typo of a member name is impossible in C++/C#/Java. It happens to me almost once a day with Node/JS.
- ocharles 14y agoThis rings very true to me too, as our entire application is written in Perl. As much as I do like the language, the lack of just about any static guarantees mean we regress an awful lot. Yes, we have unit tests, but until we have 100% coverage we have gaps for regressions that a compiler could have picked up.
- gaius 14y agoAnyone doing a large project in an weakly-typed language will eventually spend more time writing unit tests than features. No-one should even be thinking about unit tests if they are not already using a language in which all code paths can be evaluated and type-checked at compile time. Why get a dog and bark yourself?
- sktrdie 14y agoThis is not why you write tests. You write tests to be sure nothing breaks when you make changes. And you should do this with any language, typed or not.
- nnythm 14y agoUsing a language with static typing means that there are a lot of tests you don't have to write. Do you remember the units trick from physics? If you forgot which equation you're supposed to use, keep on using identities until you're in the units you're supposed to be. Static typing checks that your units are correct for free.
- brazzy 14y agoWell, not entirely for "free", but I do agree that the price is much lower than what you end up paying eventually for the convenience of dynamic typing.
- gaius 14y agoI don't ever have to write a test in OCaml to tell me what I need to fix if I change a function signature, or add another item to a struct or an enum, or change a function to return something else, or anything like that. The compiler does it all. Every code path is evaluated at compile time. 90% of unit testing is just not needed in OCaml or Haskell (and that which you do need, there's QuickCheck for).
- sirclueless 14y agoI had the same experience when writing Haskell. I would start by inserting a function call at the top level referencing a function I hadn't written yet, and then start hacking on the function and all its helpers. Without fail, as soon as the program compiled it was basically correct. The only thing that could go wrong were legitimate algorithmic errors, such as using the wrong base cases for recursion or something.
- ovi256 14y agoSo how about using a tool like jslint that will get you 90% of the static checking and will solve the kind of crash you mentioned ? Looks pretty good to me.
- mercurial 14y agoDoes jslint handle imports? Which would be surprising, given the lack of a standard system in Javascript? If it doesn't, then this leaves you very far from your 90%. On the other hand, pylint for Python is really good for static checking, even if it won't catch everything.
- Tichy 14y agoExcept that to work around the pesky types, Java people started moving everything into XML. Now they have a horrible solution to being able to work typeless.
- brazzy 14y agoApparently you haven't looked at Java development in the last 5 years, so you may want to stop making statements about it that make you look like a fool.
- Tichy 14y agoI just did a three month enterprise Java project. I admit that I hadn't used it in a while, so I picked Spring like in the old days (+Hibernate at first, but had to kick it out eventually). And hell it turned out complicated (even with Spring). What is the new mantra that makes Java suddenly usable? Playframework?
- brazzy 14y agoIt doesn't look like you're interesting in anything except following your own mantra of "Java suxx", but XML configuration files (which were never really about working around the type system) have been almost universally replaced by annotations.
- Tichy 14y agoI know about annotations, but I admit to not being the biggest fan. And they lead to even more files...
- brazzy 14y agoHow so? I've only ever seen them eliminate external configuration files. Hell, thanks to annotations and some simplifications to the standard, EJBs have turned from the epitome of overengineered bloat into a simple, lean service layer.