- 1
- 0
- 约11.95万字
- 约 29页
- 2018-12-21 发布于河北
- 举报
callback概念
Callback Implementations in C++
Copyright © 1996-1997 by Paul Jakubik. Copying for TOOLS USA distribution permitted.
Patterns and complete source code available at /~jakubik/callback.html.
Abstract: This paper presents pattern histories for deriving two different callback libraries.
The pattern histories document the important design decisions behind each library. The two
resulting libraries are compared to determine which patterns led to a better solution. The
patterns community is identifying many different patterns that solve the same problems.
This paper shows that it is possible to use objective comparisons of the resulting solutions,
as opposed to relying on personal reactions, the expertise of the author, and finding three
previous uses of the pattern, to determine which patterns lead to better solutions.
INTRODUCTION
Callbacks are most easily described in terms of the telephone system. A function call is analogous to calling
someone on a telephone, asking her a question, getting an answer, and hanging up; adding a callback changes the
analogy so that after asking her a question, you also give her your name and number so she can call you back with
the answer. In this paper, the original caller is the client, and the callee who calls the client back is the server.
Callbacks have a simple goal, but a wide variety of implementations. Each solution differs in how wide a variety
of clients can be called back and how much the server is coupled to the client.
This paper does not describe callbacks as a general pattern, instead it focuses on showing a variety of callback
solutions and the patterns used to create them. A more general discussion of callbacks can be found in [Berczuk].
Some examples of where callbacks are useful can be found in [Lea] and [Schmidt].
The range of callback
原创力文档

文档评论(0)