File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Scala and the fly likes Scala + Akka Vs Java Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Scala
Bookmark "Scala + Akka Vs Java Thread" Watch "Scala + Akka Vs Java Thread" New topic
Author

Scala + Akka Vs Java Thread

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1372
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 ?
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1670
    
  14

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.


    No more Blub for me, thank you, Vicar.
    kri shan
    Ranch Hand

    Joined: Apr 08, 2004
    Posts: 1372
    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

    Joined: Mar 01, 2009
    Posts: 1670
        
      14

    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.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Scala + Akka Vs Java Thread