Scala功能设计模式目录 [英] Scala Catalog of functional Design Patterns

查看:94
本文介绍了Scala功能设计模式目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从一周以来,我正在阅读Scala中的编程。
作者一步一步地介绍了语言的元素,但是当使用像演员,关闭,currying,....等功能的东西时,我仍然感到困惑。

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.

我并不是重新实现像Scala这样的知名模式,比如:

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

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

推荐答案

困惑于什么时候使用闭包或currying就像是混淆什么时候使用类。他们只是语言的一部分,并且服务于您所提供的任何任务。当OO第一次达到主流时,几乎同样的问题被问到课堂。

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.

这篇关于Scala功能设计模式目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆