功能OO混合语言的设计模式? [英] Design patterns for functional-OO hybrid languages?

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

问题描述

我已经找到了有关功能语言设计模式的工作, 功能战略规划的设计模式 。有OO语言的 GoF 设计模式。但是功能性OO杂种有什么模式吗?我所看到的只是这个列表。什么是已知的?

Is there already any collection of best practices for languages like Scala?

推荐答案

Bill Venners的两种模式;我认为两者都在ScalaTest中大量使用:

解决方案

Two patterns from Bill Venners; I think both are heavily used in 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模拟的 Haskell 键入类设计模式。第一个描述(至少可以找到)在
可怜的人类型类这个主题也有一些博客条目。

We can also consider the Scala emulation of Haskell type classes a design pattern. The first description (that I could find at least) is in Poor 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混合语言的设计模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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