• Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about functional programming book

 
David Starina
Greenhorn
Posts: 8
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Does the book talk about Scala and/or mentions differences between Java and Scala? If I understand correctly, Scala was the way to go for functional programming on JVM - is Functional programming in Java changing that?

Thank you!
--David
 
chris webster
Bartender
Posts: 2407
33
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might like to check out this Scala Tutorial for Java Developers.

Scala is not the only option for FP on the JVM e.g. Clojure (based on Lisp) is also gaining popularity, but Scala seems to be more widely used. Scala is a hybrid OO/FP language, so you can choose to write Scala like a "better Java" i.e. mainly in OOP style, or you can program in a strictly FP style. Some people see this as an advantage, because it can help Java developers transition gradually to Scala (many companies take this approach to introducing Scala), but others point out that this duality can make Scala more complicated and harder to learn: every problem has at least two solutions!

Now Java is starting to provide more FP features, you have more options within Java as well. FWIW (and with respect to Venkat), I prefer to use Scala because FP is built in to the language, rather than bolted on as in Java. But it will depend on your project and your developers - YMMV as always!
 
David Starina
Greenhorn
Posts: 8
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Chris. But I guess Java has the advantage of not having to learn another programming language Can you get the same functionality as in Scala in Java 8, or is Scala still worth learning?
 
chris webster
Bartender
Posts: 2407
33
Linux Oracle Postgres Database Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Starina wrote:Thanks, Chris. But I guess Java has the advantage of not having to learn another programming language Can you get the same functionality as in Scala in Java 8, or is Scala still worth learning?

I'm not using Java 8, so you'd need to ask Venkat for a more informed opinion! But I would assume you can do pretty much everything in Java that you can do in Scala (they're both VM languages and compile down to the same bytecode underneath), but you will probably find that many things can be achieved more easily and concisely in Scala. That's one of the first things you notice if you start writing Scala as a "better Java". When it comes to FP, I think Scala is probably the better choice purely in language terms, because FP is baked into the language from the ground up, and Scala has very powerful libraries that take advantage of FP as well. My guess is that Java still has a long way to catch up on the FP side of things.

Anyway, it's always good to learn a new language, so go try it out for yourself and see what you think!
 
Venkat Subramaniam
Author
Ranch Hand
Posts: 109
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that Chris's response is pretty right on from all angles. Thanks.
 
David Starina
Greenhorn
Posts: 8
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Venkat, Chris, thank you. I think I will take the time to look into Scala.

Venkat, in your book, do you do any Java/Scala comparison, or do you just focus on the Java's take on FP?
 
Venkat Subramaniam
Author
Ranch Hand
Posts: 109
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David, no in this book I focus only on Java 8. I've written books on Scala and Groovy, and also use quite a few other languages on the JVM on a regular basis. I do not see a reason to compare with one and not the other languages in a book like this. My objective for writing this book is to help Java programmers get up to speed on this newer facilities and so have kept it topics spot on that.
 
David Starina
Greenhorn
Posts: 8
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Understood, you are right. Thank you. I'll take a look at your book, it might be something quite useful for me Also, good luck with your sales.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!