Scala Catalog of functional Design Patterns

本秂侑毒 提交于 2020-01-12 03:14:11

问题


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

  • http://github.com/greedy/scala-study-group/tree/master/patterns/

回答1:


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.



来源:https://stackoverflow.com/questions/2205721/scala-catalog-of-functional-design-patterns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!