• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Scala vs Java  RSS feed

 
Ranch Hand
Posts: 1175
3
Java Netbeans IDE Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am starting planning a web project, I have not idea about Scala. Looks like after the learning curve it is worth it I am talking just in base to some posts I readed.

Any opinion about this? Maybe open a discussion?

Regards, Isaac
 
Author
Ranch Hand
Posts: 183
9
Java Linux Netbeans IDE Scala Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you trying to solve a business problem, or learn something cool? If the former, use a language you already know (assuming it's reasonably suitable, and if you already know Java, then yes, it's reasonably suitable ) If the latter, then use Scala and have fun.

Oh, and if you're trying to learn a skill that's marketable in the job market, frankly, Java is still so far ahead of Scala that a direct comparison would be pointless. But if you want a "little something different" (and you're confident that your Java skills are up to scratch and not worth improving), then Scala on your resume might add something.
 
Bartender
Posts: 2407
36
Linux Oracle Postgres Database Python Scala
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Simon says, it depends!

If you want to go ahead and explore Scala, you will need to put some work into it, as the learning curve can be a bit steep and it depends on your previous experience. You don't need to be a Java expert before you start with Scala, but some Java experience is helpful - and it may help you to appreciate some of the benefits of Scala. Learning Scala may even help to make you a better Java programmer! Scala is a hybrid OO/functional programming language, which means you can program in OO style and use it as a "better Java". Or you can program in a purely functional style like the real gurus. But most people seem to work somewhere in between those extremes, and it is common to start out programming Scala like Java and gradually become more functional as you gain experience/understanding. The Scala website has a quick intro to Scala for Java programmers.

Personally, I found I needed some structured guidance when starting with Scala - I probably still do! I started with the excellent free Coursera course Functional Programming Principles In Scala by Scala creator Martin Odersky. This course seems to run every year in the autumn and is a great way to get started with FP in Scala. We also have some tips for getting started with functional programming here on JavaRanch. There is also some excellent material for learning Scala on Twitter's Scala School website - Twitter has been a big user of Scala and has contributed various tools and libraries to the community.

There are not too many beginner's books for Scala, although I've heard good things about Bruce Eckel's Atomic Scala which is aimed at complete beginners - you can download a free sample of the first 100 pages from the book's website.

Cay Horstman's book Scala For The Impatient is aimed at people with some Java experience and gets good reviews, although it's a couple of years old now and Scala is moving fast.

The standard reference for Scala is probably Martin Odersky's Programming In Scala (2nd edition), although this is also quite old now - I think the 3rd edition is due out soon.

My current favourite general purpose Scala book is Programming Scala by Dean Wampler and Alex Payne (2nd edition came out in 2015), which covers a lot of ground in reasonable detail, from basic syntax through to reflection and macros. The ideal companion to this book is probably Alvin Alexander's Scala Cookbook which is full of great recipes for doing all kinds of things in Scala.

As for your project, there are several options for a web application: the Play framework is an MVC-style web application framework that is widely used in Scala-land, Spray is a lightweight HTTP REST framework, Scalatra is a lightweight web application framework that is also quite popular as an alternative to Play, and Lift is another web framework although it doesn't seem to be as actively used or maintained as Play.

One useful starting point for installing Scala tools is the Typesafe Reactive Platform, which bundles several Scala tools and frameworks (e.g. Play, Akka) together with the Typesafe Activator (a wrapper for the SBT build tool - think Maven without XML). The browser-based "Activator UI" tool is a Play application, and it allows you to download and run various tutorials and demo applications, which can be useful for getting a quick insight into new libraries etc, although the user-contributed projects vary in quality.

It's certainly true that Java is still far more widely used than Scala, and it probably always will be. But Scala is being used for lots of really interesting stuff, especially around Big Data, distributed processing and scalability. Tools like Kafka (messaging), Spark (distributed analytics) and Akka (actor-based concurrency) are all written in Scala. There are Java APIs for all of these, of course, but it can feel more natural to use Scala for this kind of work e.g. the Scala API for Spark is much easier to use than the Java API, and there is a sense of "mechanical sympathy" when you work in this way.

A lot of this stuff is increasingly based on ideas from the Reactive Manifesto, and Typesafe (the company behind Scala) has taken this up in a big way, so we can probably expect to see more developments in Scala along these lines. Back in 2013, Dean Wampler described big data as the killer app for functional programming and so far I think he's been proven right.

For example, I'm seeing a growing number of Scala developer jobs in the financial sector, often in combination with Spark or Hadoop, and these jobs are very well-paid compared to equivalent Java jobs, although of course there are lots more Java jobs.

Anyway, there are lots of arguments for/against using Scala or Java, so you can surf around and look at these yourself. There have been some discussions about this here on JavaRanch too:

  • Why Scala? (2014)
  • Why should one shift from Java to Scala? (2013)
  • What kind of things are easier in Scala? (2013)
  • Scala in commercial IT? (2013)
  • Scala sceptic (2013)

  • Or you could just try it out and decide for yourself. Have fun!
     
    Bartender
    Posts: 19812
    93
    Android Eclipse IDE Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Scala got quite popular in my hometown a year or so back, but I don't recall any of the local companies actually recruiting for Scala talent.

    You can add Neo4J to the systems that are written at least partially in Scala.
     
    chris webster
    Bartender
    Posts: 2407
    36
    Linux Oracle Postgres Database Python Scala
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Tim Holloway wrote:Scala got quite popular in my hometown a year or so back, but I don't recall any of the local companies actually recruiting for Scala talent.

    You can add Neo4J to the systems that are written at least partially in Scala.


    What I'm seeing is a small number of high quality jobs e.g. in the London financial sector and in Big Data generally, also some public sector work in the UK, and some similar jobs starting to appear in the Netherlands and elsewhere. You're right, Scala is certainly not going to be a mainstream "bread-and-butter" skill any time soon. Fortunately, I'm not looking for a mainstream "bread-and-butter" job either, so the current trend looks fine to me. YMMV of course!

    Thanks for the Neo4j tip - I didn't know that.
     
    Tim Holloway
    Bartender
    Posts: 19812
    93
    Android Eclipse IDE Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    chris webster wrote:
    Thanks for the Neo4j tip - I didn't know that.



    I discovered it the hard way. With a debugger.
     
    Ranch Hand
    Posts: 55
    Java Mac OS X Scala
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Tim Holloway wrote:Scala got quite popular in my hometown a year or so back, but I don't recall any of the local companies actually recruiting for Scala talent.

    You can add Neo4J to the systems that are written at least partially in Scala.




    Just so you know, they developed the cypher engine in scala (the graph query language).
     
    Ranch Hand
    Posts: 239
    12
    Eclipse IDE IntelliJ IDE Java Scala Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Isaac Ferguson wrote:Hi,

    I am starting planning a web project, I have not idea about Scala. Looks like after the learning curve it is worth it I am talking just in base to some posts I readed.

    Any opinion about this? Maybe open a discussion?

    Regards, Isaac



    In my opinion you should do it in Scala and forget about Java! Sure Java is sufficient, but it is also kinda painful once you see how nice Scala makes things!

    Plus, it is not a binary question. When / If you need to, you can easily employ both Scala and Java. There's no downside at all to doing it in Scala IMO!!

    Check out some of these links...I hope they make you as excited about Scala as they did me.

    Why not make the transition from Java to Scala?
    3 Simple Reasons Why You Need to Learn Scala
    Scala. Wat.
    Learning Functional Programming Without Growing A Neckbeard
    10 Scala One-Liners To Impress Your Friends
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!