4

I have to do a presentation of the callback pattern. I just want to be sure that I got it right because of what I read about callbacks, callback functions and callback pattern...

The design pattern callback is very similar to the observer pattern.


The first one is easier to implement but will probably mess with an MVC implementation. You have to call specific functions or methods to make the callback. There's no specific class diagramm.

http://soapatterns.org/design_patterns/service_callback

http://searchdaily.net/callback-pattern-with-rmi-client-callback/#more-2009


The second is made for MVC, have a specific class diagramm, etc. (I can look on wikipedia if I need)


So my questions are :

Is what I wrote right ?

Are my 2 links correct (speaking of the pattern callback) ?

Do we agree that callback pattern and function are 2 completely different things ?

TheDeveloo
  • 413
  • 4
  • 13

3 Answers3

2

So there's no such thing as a Callback pattern. There's callback functions and a callback mechanism (used in the observer pattern).

Here are the links I used. If you want the presentation just ask ;) (Sorry I had to remove http because I don't have enough reputation to add more than 2 links)

Callback Pattern » Searchdaily | Searchdaily.
http://searchdaily.net/tag/callback-pattern/

SOAPatterns.org | Design Patterns | Service Callback. http://soapatterns.org/design_patterns/service_callback

oop - Observer pattern or Callback? - Stack Overflow.
stackoverflow.com/questions/4583269/observer-pattern-or-callback

Callback (computer programming) - Wikipedia, the free encyclopedia. en.wikipedia.org/wiki/Callback_%28computer_science%29

RoR Guide & Solutions: Difference between Validations, Callbacks and Observers. rorguide.blogspot.ch/2011/07/difference-between-validations.html

Software design pattern - Wikipedia, the free encyclopedia. en.wikipedia.org/wiki/Software_design_pattern

Design Patterns - Wikipedia, the free encyclopedia.
en.wikipedia.org/wiki/Design_Patterns_%28book%29

oop - Is there a design pattern that deals with callback mechanism? - Stack Overflow. stackoverflow.com/questions/946834/is-there-a-design-pattern-that-deals-with-callback-mechanism

TheDeveloo
  • 413
  • 4
  • 13
1

I don't see a difference between a callback and a callback function.

The difference between a callback function and a callback pattern, however, is that the function is the piece of logic that actually gets executed and the pattern is the design of the code that makes the execution happen.

callback function - SO link callback pattern - SO link.

Community
  • 1
  • 1
Seeta Somagani
  • 776
  • 1
  • 11
  • 31
0

A good pattern description is the Service Callback design pattern. It's part of a catalog of SOA patterns, but the pattern can be used even if you're using generic components instead of SOA services.

The Observer pattern is similar to the publish-subscribe pattern, not callback.

Design patterns can be illustrated with class diagrams when they specify methods and inheritance. Patterns like Service Callback can be illustrated with generic component boxes because they focus on the component interaction.

Paulo Merson
  • 13,270
  • 8
  • 79
  • 72