9 ms·
So Scala or Clojure it is? Honestly, I am starting to learn Java as a very amateur programmer and this is over my head. Are the other JVM languages actually d
by 616c 12y ago
So Scala or Clojure it is? Honestly, I am starting to learn Java as a very amateur programmer and this is over my head.
Are the other JVM languages actually doing better as they were architected differently from their core, the models for parallelism and/or concurrency is different, both? I would love to hear comments from those more educated than I in JVM esoterics (although I would say the money involved it is worth knowing).
- ecopoesis 12y agoBy default, Scala's parallel collections use fork/join on JVMs > 6, so using Scala probably isn't going to change much for you.[1] Also, note that this guy's company makes software that directly competes with the JVM's fork/join framework, so he's not exactly an unbiased source.[2] [1] http://docs.scala-lang.org/overviews/parallel-collections/configuration.html http://docs.scala-lang.org/overviews/parallel-collections/co... [2] http://www.coopsoft.com/Products.html http://www.coopsoft.com/Products.html
- raspasov 12y agoVery good point, they also have a VERY cool website http://www.coopsoft.com/ http://www.coopsoft.com/
- 616c 12y agoJust the kind of analysis I was looking for. Thanks.
- hibikir 12y agoThe way this problems change in Scala is not by using the parallel collections library, but by using Akka straight up, or using Spark. Akka is an actor system framework, so it's extremely well suited for this problem. Spark can process tremendous amounts of data in parallel, even over hundreds of machines if you really have the iron, and works just as well with just one machine. You can technically use them both from Java, but being natively Scala libraries, you are really better off switching to Scala if you are going to use them.
- zackangelo 12y agoIndeed, the Akka team published an blog post [1] a while back that demonstrates superior performance versus a traditional thread pool. The actor model seems to be a very favorable use case for F/J though. [1] http://letitcrash.com/post/17607272336/scalability-of-fork-join-pool http://letitcrash.com/post/17607272336/scalability-of-fork-j...
- jayd16 12y agoIf you're an amateur programmer then you probably don't have to worry about this. Just be aware that threading is complicated. Don't go looking for languages to solve problems you don't have just because of a blog post.
- hga 12y agoOn the other hand, as a Lisp is the True Way type, I believe there are very good reasons to learn a Lisp early in your study of programming. While Scheme has a lot going for it in this domain, Clojure is not bad at all, and it happens to have a lot of good solutions for concurrent programming.
- jbooth 12y agoEveryone should learn a Lisp early in their career. Anyone who actually cares about performance will learn quickly that auto-parallelizing or 'parallel collections/streams' is a joke, with Amdahl's law being the punchline.
- 616c 12y agoDon't worry, done and done. I play with Common Lisp on my machine, and I definitely dream of writing a web app in Clojure and Clojurescript once I finish some Java coursework. Things will slow down and I will understand the underlying Java/JVMisms as well as bonus. (Taking Java for school reqs, not for this reason of course, but it would be nice.)
- 616c 12y agoI wanted to get back into programming largely bc of what I read here and on my collection of programming Reddits. So much interesting and beautiful stuff. And I know the increasing popularity of the JVM (if it ever wanted), is that the JVM primitives allow for some threading, which means parallel/concurrent use of processors cores at all. Seeing as people whine about Python and Ruby and GIL, native threads have to be found somewhere while also offering the own risks. But thanks, I like this site because I can get a programmer's education in "what I worry about and what to avoid unless I am ready" while I learn, not after.
- pjmlp 12y agoDepends on where you plan to find work. In what concerns the typical enterprise, the JVMs and Android are all about Java. Many use Scala and Clojure as filter for good developers, but the daily work language is still Java.
- threeseed 12y agoBest to stick with Java. It's noticeable that some companies are switching back from Scala to Java e.g. LinkedIn, Yammer and after using it for a while it's not hard to see why. It's awfully complex and obtuse in many parts. Clojure simply isn't that popular and likely won't be.
- jarjoura 12y agoFan and user of Clojure here :). It's a Lisp and popular enough to use safely and if you don't mind the syntax, go for it. You find it used in all those companies in small projects, so these companies are always looking for engineers who would also be comfortable in it.
- azth 12y agoThe Yammer switch happened quite a while ago. The language now is more stable and performant. Other than these two isolated incidents, there isn't really anything to "notice".
- lmm 12y agoScala gives you nice options around managing concurrency; it's explicit but not verbose, and you end up writing code that uses general techniques that apply to other cross-cutting concerns rather than being concurrency-specific. Another reply points out that the default pool is a Java fork-join pool - but it's a 1-liner to change that if you want. (I have no connection with any selling of concurrency solutions; I use scala (including spark and scalaz-stream) professionally)