Forums Register Login

Question about functional programming book

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
 

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!
+Pie Number of slices to send: Send
I think that Chris's response is pretty right on from all angles. Thanks.
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 890 times.
Similar Threads
Required knowledge to read "Programming Scala"
Kotlin in Action: Beyond avoiding Null Pointer Exceptions?
Grails: A Quick Start Guide Question to Dave Klein
Questions on Clojure
The Java Performance Companion book question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 07:41:21.