Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To use or not to use Scala for new Java projects? [closed]

I'm impressed with Twitter and investigating to use Scala for a new large scale web project with Hibernate and Wicket. What do you think about Scala, and should I use it instead of Java?

EDIT: And, do you think Google's Noop, Fan or Scala can take the leadership from Java in the near future, which one have chance in your opinion?

like image 581
sirmak Avatar asked Nov 14 '09 12:11

sirmak


People also ask

Is Scala still relevant in 2022?

Scala is highly recommended for beginners because of its easy learning. Scala was designed to solve problems that Java developers had with Scala. It has been a well-known language among developers for a long time.

Should I learn Scala 2022?

Scala is worth learning in 2022. The demand for Scala developers is high, and the pay is good.

Should I use Scala or Java?

Scala has an exact syntax, eliminating boilerplate code. Programs written in Scala require less code than similar programs written in Java. It is both an object-oriented language and a functional language. This combination makes Scala the right choice for web development.

Does anyone still use Scala?

Before the luxurious, full-featured ecosystems and programming languages of today, things like Data Science used to be significantly different. One language that has been used a lot in the past and is still used today is Scala.


2 Answers

Don't forget that you can use it alongside Java. i.e. you can make use of compiled .classes and .jars within a Scala-scripted environment.

So you may want to encode the lower-levels of your solution in Java and then wrap these in Scala to provide a more flexible and agile solution (in terms of rewriting business logic at a higher level).

Something to consider is who else is going to look after this and maintain it. For all of Scala's hype, relatively few people can code in it (as of Nov 2009), and you may have to hire people in the future to look after it. Looking for Scala people will mean you're looking in a much smaller pool of candidates (some may want to learn Scala on the job, but there's still a start-up cost)

like image 79
Brian Agnew Avatar answered Oct 20 '22 09:10

Brian Agnew


Here are the pros and cons of Scala relative to Java IMHO:

Pros:

  • Much more concise syntax for idioms common in modern Java code
  • Closures
  • More powerful type system including mixins
  • Pattern matching
  • Great REPL, 2.8 will even have tab-completion

In summary: You get a lot more functionality with a lot less code than Java

Cons:

  • IDE support is still of alpha or beta quality, although IDEA has the best support currently
  • The standard library is not immune to changes with each new version (2.8 will have backwards incompatible changes)
  • The standard library had significant bugs at least as recently as a year ago (when I found one in the JSON support)

I think Scala will be ready for major production use in 6-8 months, but I wouldn't bet my project on it today.

like image 22
sanity Avatar answered Oct 20 '22 09:10

sanity