views:

430

answers:

1

Since a week I'm reading Programming in Scala. The authors introduce elements of the language step by step , but I'm still confused when to use the functional things like actors, closures, currying,....

I'm looking for a catalog of typical use cases or best practices for functional contructs.

I don't mean reimplementing well known pattern like GoF in Scala like

+4  A: 

Being confused about when to use closures or currying is like being confused about when to use classes. They are just part of the language, and serve any task you put it to. When OO first reached mainstream, pretty much the same question was asked of classes.

As for actors, they are a distributed programming paradigm -- and not, mind you, part of the language itself. They are used when you want to take advantage of concurrency, and your application does not need to share state between concurrent processes, nor is it mainly oriented towards parallel processing.

Daniel
You're probably right, I'm familiar with OO and I understand your answer. For OO I could have asked when to use inheritance or aggregation, when should I have an interface and so on. For these questions one would find many resources but when to use which functional construct is a bit hard without any experience. A link to a discussion of these topics would be fine.
stacker
@stacker That's true enough, and I, myself, don't know much what to recommend. Some books, such as The Little Schemer and The Seasoned Schemer, by Daniel Friedman, or Purely Functional Data Structures, by Chris Okasaki, may help some. But there's nothing out there like Scala. For instance, the _option_ to have currying is rather rare. In most language, either everything is curried, or nothing is. And, of course, the mix of OO makes it even more difficult to choose an approach.
Daniel
I found this helpful site: http://scala.sygneca.com/code/start
stacker