3 ms·
What do you mean by "dynamically typed garbage" ?
by pki 12y ago
What do you mean by "dynamically typed garbage" ?
- M8 12y agoSorry - bad mood.
- YousefED 12y agoI thought your comment was hilarious and a good explanation at the same time :)
- collyw 12y agoFrom what I read Java has one of the least good implementations of static typing. Most effort for the least gain. (From when I have asked about the benefits of static typing on here).
- edejong 12y agoThat's a sentiment I would disagree with. Surely, there are better static type checkers out there, but all of them have compromises. Many users of the language Java have trouble understanding the complications of proxies, generics and reflection. Unless one is well-versed in these technologies, one might be tempted to blame the type-checker. Frameworks such as Spring or Hibernate, perturb the purity of the type-system. This creates complexity in larger projects, and again the users would blame the language, instead of the framework. There are many valid complaints on Java's type system, such as its verbosity or type inference. Scala seems to solve the most pressing issues with these. I'd say Objective-C's type-system is much less powerful.
- beat 12y agoI think a more interesting comparison is modern languages like Haskell and OCaml, which have much more powerful type systems than Java. The point that Spring and Hibernate undermine the type system is valid, but why do they undermine the type system? Because it's inadequate for cleanly expressing as common a problem as ORM. If you need to resort to dependency injection and more-or-less invisible abstraction layers to write readable code, your type system has failed you. Consider by contrast the ActiveRecord model from Rails. It's exquisitely simple and understandable, and does an enormous amount of work for you in very little code, while frankly being no more problematic or dangerous than Spring and Hibernate. Of course, this is in large part due to Ruby metaprogramming power that springs from dynamic typing, but I don't think that means dynamic typing is superior. Clearly, it's not protecting you from a lot of basic problems that a static type check can catch. So how do you get a type system that provides the benefits of static typing, without getting in the way of clean code and leading to ugly workarounds? How do you make strong typing help rather than hurt on the small scale as well as the large? I don't know yet, because I'm no expert on more modern languages. But Java isn't managing it.
- mike_hearn 12y agoHibernate doesn't require dependency injection. I'm not a big fan of DI either, but I'm not sure what it's got to do with type systems either. The Java type system is quite old. It's doing some interesting new things anyway like the pluggable type systems via the Checker framework, but nobody is going to claim Java has a cooler type system than Haskell. If you look at Kotlin, it makes some small but much needed upgrades to the Java type system, like real properties, traits, delegates, function types, integrated nullability and flow sensitive typing, better generics etc. It doesn't go as far as Haskell though.
- edejong 12y agoI don't think it's fair to compare Java with Haskell or OCaml since they don't share the same objectives. But even if you did compare them, you should try to match Java's subtyping with Haskell's more-or-less dependent types. Java's type system is apparently strong enough to express co- and contra-variance, which is quite an accomplishment. Talking about ActiveRecord: I've come to understand this system has been the focal-point of insecurity by design issues (http://railspikes.com/2008/9/22/is-your-rails-application-safe-from-mass-assignment http://railspikes.com/2008/9/22/is-your-rails-application-sa...) To answer your question, I'd strongly suggest to have a look at Scala. It's clean code, easy to read, fast and as expressive as ActiveRecord (plus the type-safety).