问题描述
我已经找到了有关功能语言设计模式的工作, 。有OO语言的设计模式。但是功能性OO杂种有什么模式吗?我所看到的只是列表。什么是已知的?
Is there already any collection of best practices for languages like Scala?
推荐答案
Bill Venners的两种模式;我认为两者都在ScalaTest中大量使用:
(允许图书馆设计师提供他们的客户可以通过访问的服务mixin或进口)。
Selfless Trait (allows library designers to provide services that their clients can access either through mixins or imports).
- 就像可扩展组件抽象一样,它不是一个模式cata日志,但它也处理类似的问题(例如,访客模式)
Independently Extensible Solutions to the Expression Problem - just like the "Scalable Component Abstraction", it's not a pattern catalog, but it also deals with similar problems (e.g. the Visitor pattern)
- 观察者的替代方法。
Deprecating the Observer Pattern - an alternative to the Observer.
我们还可以考虑Scala模拟的键入类设计模式。第一个描述(至少可以找到)在
这个主题也有一些博客条目。
We can also consider the Scala emulation of Haskell type classes a design pattern. The first description (that I could find at least) is inPoor Man's Type Classes. Quite some blog entries are also available with this topic.
而且,如果我还提到了各种单子,我觉得我没有完全错误。你可以找到很多资源来处理它们。
And I think I'm not completely wrong if I also mention the various monads. You can find a lot of resources dealing with them.
这篇关于功能OO混合语言的设计模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!