aspose file tools*
The moose likes Scala and the fly likes Functional Programming in Practice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Languages » Scala
Bookmark "Functional Programming in Practice" Watch "Functional Programming in Practice" New topic
Author

Functional Programming in Practice

Ari King
Greenhorn

Joined: Apr 22, 2010
Posts: 20
Hi Paul & Runar,

I believe you both at some point worked at Capital IQ and used FP (via Scala) to implement data processing apps. Could you expound, to the degree possible, on how FP helped in implementing those algorithms/tools? Could you also share why the chosen language was Scala as opposed to Java or other FP languages like Clojure & Groovy? Thanks.

Best,
Ari
Ari King
Greenhorn

Joined: Apr 22, 2010
Posts: 20
Ari King wrote:Hi Paul & Runar,

I believe you both at some point worked at Capital IQ and used FP (via Scala) to implement data processing apps. Could you expound, to the degree possible, on how FP helped in implementing those algorithms/tools? Could you also share why the chosen language was Scala as opposed to Java or other FP languages like Clojure & Groovy? Thanks.

Best,
Ari


Most of the threads here discuss how/when FP is a better implementation choice than OO. Are there any circumstance where the opposite holds?
Paul Chiusano
author
Greenhorn

Joined: Feb 06, 2013
Posts: 9
Hi Ari,

You might want to check out this old blog post of mine, which is sort of an experience report I wrote after our first year or two using Scala: http://pchiusano.blogspot.com/2009/08/scala-success-story-commercial-usage-of.html Some of the stuff in there is out of date, and I may not agree with everything in there anymore, but it talks about some of the benefits we got from using Scala. Overall, I'd say the benefits we got from using Scala were just the usual benefits one gets from FP - compositionality, reuse, modularity, testability, much fewer bugs, etc. Personally, I did not know much FP when I started using Scala (I had used functions like map/filter/fold in various languages, and that was about it), and found that the more I learned, the more I saw of the above benefits.

As for why not Clojure or Groovy, well, I feel that a good static type system is essential to functional programming. Also, Clojure I don't think was even out when I started using Scala (late 2007) at Capital IQ, or if it was it was super super new. I do remember looking at another JVM language, CAL (http://openquark.org/Welcome.html), but I felt like Scala had more momentum and more seamless interoperability with Java, which was important.
Paul Chiusano
author
Greenhorn

Joined: Feb 06, 2013
Posts: 9
Ari King wrote:
Most of the threads here discuss how/when FP is a better implementation choice than OO. Are there any circumstance where the opposite holds?


Like I was saying in another thread (http://www.coderanch.com/t/629025/Scala/Scala#2879406), we don't usually consider OO and FP to be in conflict. It's more FP vs imperative programming / using side effects. I don't think using side effects are ever 'better', though we might use local mutation within the implementation of a pure function, say for performance. IMO, side effects are pretty universally bad when they are anything other than an implementation detail for a purely functional API.

The one thing I would say is that following FP is a discipline. After a while, following that discipline becomes effortless, but until you've learned enough FP, it is 'easier' to just resort to using side effects. That is, FP requires some up front investment - much of part 1 of our book is relearning how to do things that people already know how to do in imperative programming. There is some new stuff in part 1, but most of it is laying a foundation so that we can do all the fun stuff which is truly new and unique to FP in parts 2, 3, and 4.
Ari King
Greenhorn

Joined: Apr 22, 2010
Posts: 20
Thanks for sharing your experiences/insights. As a follow-up to the original question, was it difficult to get developer/management buy-in with FP and/or Scala when re-writing clarifi? While FP (via Scala) made the code base more manageable (i.e. testable) did it increase complexity as you were still learning FP/Scala?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Functional Programming in Practice