有关异步编程设计模式资源 [英] Resources about Asynchronous Programming Design Patterns

查看:106
本文介绍了有关异步编程设计模式资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找不平凡的资源上的异步编程,preferably书籍,还大量文章或论文的概念。这不是像传递回调到一个事件监听器,在GUI编程,或有生产者 - 消费者脱钩了一个队列,或为你的HTML写一个onload事件处理程序(虽然所有这些都有效)的简单的例子。这是关于在一个浏览器或运行node.js中的那种问题,lighttpd的开发商可能会担心,或者有人在JavaScript中做大量的商业逻辑这是关于你需要一个回调传递给回调回调...对复杂的异步控制流的情况下,并在同一时间住理智。我在寻找的概念,让你做这个系统,来思考这种控制流,认真管理分布在深嵌套回调,具有定时,同步所有的问题随之而来逻辑的显著量,结合值,通过上下文等。

I'm looking for non-trivial resources on concepts of asychronous programming, preferably books but also substantial articles or papers. This is not about the simple examples like passing a callback to an event listener in GUI programming, or having producer-consumer decoupled over a queue, or writing an onload handler for your HTML (although all those are valid). It's about the kind of problems the lighttpd developers might be concerned with, or someone doing substantial business logic in JavaScript that runs in a browser or on node.js. It's about situations where you need to pass a callback to a callback to a callback ... about complex asynchronous control-flows, and staying sane at the same time. I'm looking for concepts that allow you to do this systematically, to reason about this kind of control-flows, to seriously manage a significant amount of logic distributed in deeply nested callbacks, with all its ensuing issues of timing, synchronization, binding of values, passing of contexts, etc.

我也不会从一些抽象的探索一样延续传递式,线性逻辑或时间推理缩水了。如员额在本似乎进入了正确的方向,而是讨论具体问题不是一个完整的理论(如后提到了反应堆的格局,这似乎是相关的,没有描述它)。

I wouldn't shrink away from some abstract explorations like continuation-passing-style, linear logic or temporal reasoning. Posts like this seem to go into the right direction, but discuss specific issues rather than a complete theory (E.g. the post mentions the "reactor" pattern, which seems relevant, without describing it).

感谢。

编辑:

为了让更多细节我感兴趣的方面。我很感兴趣,有纪律的方式来异步编程,一个理论,如果你愿意,也许只是一组特定的模式,我可以传给同胞程序员和说这是我们做的异步编程的方式,在不平凡的场景。我需要一个理论来理清回调,它随机无法正常工作,或产生虚假的结果层。我想一个办法,让我说,如果我们做这种方式,我们可以肯定的是......。 - ?这是否让事情更清晰。

To give more details about the aspects I'm interested in. I'm interested in a disciplined approach to asynchronous programming, a theory if you will, maybe just a set of specific patterns that I can pass to fellow programmers and say "This is the way we do asynchronous programming" in non-trivial scenarios. I need a theory to disentangle layers of callbacks that randomly fail to work, or produce spurious results. I want an approach which allows me to say "If we do it this way, we can be sure that ...". - Does this make things clearer?

编辑2:

由于反馈表明编程语言的依赖。这将是JavaScript的,但也许它足以承担语言,允许高阶函数

As feedback indicates a dependency on the programming language: This will be JavaScript, but maybe it's enough to assume a language that allows higher-order functions.

编辑3:

改变了标题更具体的(虽然我觉得设计模式只是看看它的一种方式,但至少它提供了更好的方向)。

Changed the title to be more specific (although I think design patterns are only one way to look at it; but at least it gives a better direction).

推荐答案

在做分层回调钻营是一种有用的技术。

When doing layered callbacks currying is a useful technique.

有关更多关于这个你可以看看 http://en.wikibooks.org/维基/哈​​斯克尔/高order_functions_and_Currying 并为JavaScript你可以看看的http:/ /www.svendtofte.com/$c$c/curried_javascript/

For more on this you can look at http://en.wikibooks.org/wiki/Haskell/Higher-order_functions_and_Currying and for javascript you can look at http://www.svendtofte.com/code/curried_javascript/.

基本上,如果你有回调的多层,而不是一台庞大的参数列表,你可以建立起来增量,这样,当你在一个循环中调用你的函数,各种回调函数已经被定义,过去了。

Basically, if you have multiple layers of callbacks, rather than having one massive parameter list, you can build it up incrementally, so that when you are in a loop calling your function, the various callback functions have already been defined, and passed.

这是不是意味着作为一个完整的问题的答案,但我要求把这个部分到一个答案,所以我做到了。

This isn't meant as a complete answer to the question, but I was asked to put this part into an answer, so I did.

在这里快速搜索是在那里他显示了使用博客与回调柯里:

After a quick search here is a blog where he shows using currying with callbacks:

http://bjouhier.word$p$pss.com/2011/04/04/currying-the-callback-or-the-essence-of-futures/

更新:

阅读编辑原来的问题,看到了异步编程设计模式后,这可能是一个不错的图:
http://www1.cse.wustl.edu/~schmidt/patterns-ace html的,但还有更多好的异步设计,一阶功能将使其能够被简化,但是,如果你使用的是MPI库和Fortran那么你将有不同的实现。

After reading the edit to the original question, to see design patterns for asynchronous programming, this may be a good diagram: http://www1.cse.wustl.edu/~schmidt/patterns-ace.html, but there is much more to good asynchronous design, as first-order functions will enable this to be simplified, but, if you are using the MPI library and Fortran then you will have different implementations.

你如何接近设计是由语言严重影响和技术参与,任何答案将功亏一篑没有完成。

How you approach the design is affected heavily by the language and the technologies involved, that any answer will fall short of being complete.

这篇关于有关异步编程设计模式资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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