• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Scala + Akka Vs Java Thread

 
Ranch Hand
Posts: 1491
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Scala and Akka supports distributed and concurrent application. Even Java Thread supports same. Why do we need functional programming instead of object oriented programming ? Why do we need another framework/toolkit akka ?
 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's a discussion of why some people use Akka here, and there's a blog post from the creator of Akka, Jonas Bonér, explaining why Akka is a good idea. There's also a video presentation on Akka by Jonas Bonér at the InfoQ website.

I think the argument boils down to a few key points:

  • Concurrency is intrinsically difficult.
  • Concurrency with threads is really difficult.
  • More distributed systems and multi-core processors mean we need to be able to support more concurrency.
  • The growth of big data applications also demands more effective use of concurrency to cope with all that extra processing (you can't do everything in Hadoop).
  • We need to make concurrency simpler in order to build robust, scalable, maintainable systems.
  • Akka offers a way to achieve this.

  • Actor systems like Akka are based on asynchronous message passing and immutable state, providing a higher level of abstraction than threads, which effectively allow you as a developer to think about the actual problem you're trying to solve, without having to worry about all the details of the plumbing. I've only just started looking at Akka myself, but already it's pretty clear that Akka provides a much simpler, cleaner and more robust approach to concurrency than anything I could come up with based on threads. Of course, I'm not much of a threads programmer anyway, but then the whole point of Akka is that grunts like me don't have to be threads gurus to work productively on concurrent systems. Which sounds good to me.

    But why not try it out for yourself? A good place to start is Derek Wyatt's excellent book Akka Concurrency. Incidentally, Akka is also available for Java, although my understanding is that certain features of Akka (specifically based on Scala's support for functional programming) are not available in the Java version.
     
    kri shan
    Ranch Hand
    Posts: 1491
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Seems few of the Java 8's features similar to Scala like Lambda expression, etc... Seems future java releases may include the features similar to Scala and we may not prefer Scala. Any thoughts ?
     
    chris webster
    Bartender
    Posts: 2407
    36
    Scala Python Oracle Postgres Database Linux
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Well, that's a different question, isn't it? Why Scala

    As for future Java additions like lambdas etc, if my project needs this kind of thing right now, and I'm not tied to Java already (e.g. by legacy code), then why wait for Java 8 (or 9 or 10...) if I can do what I want with Scala now? If you really need functional programming constructs, then you might be better choosing a language that has these things baked in, not bolted on. And Scala is not the only option for FP on the JVM - you could try Clojure for example.

    But it will depend on your project, skills, working culture etc etc. Scala might be a great choice for some projects/teams, but not for others. I don't think there is a simple yes/no answer - you need to pick the best tool for a specific job.

    PS There's a few links to talks on this topic in this thread.
     
    My first bit of advice is that if you are going to be a mime, you shouldn't talk. Even the tiny ad is nodding:
    We need your help - Coderanch server fundraiser
    https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    reply
      Bookmark Topic Watch Topic
    • New Topic