views:

79

answers:

3

Which keyword / tag should we use to describe them when we're taking notes for them.

If they are placed under the category "software design", is it appropriate?

@edit: It's more about how you category things. When you are in learning, some terminology appears, so what category will you assign it in your own ontology?

+1  A: 

Right, I suspect I’m going to reveal my stupidity here, but anyway:

  • “callback”: a function (A) passed to another function (B), that’ll be called in B to do work.
  • “closure”: a function that captures the value of variables from the scope in which it was defined

Hopefully defining them will help you classify them — I don’t think the terms “callback” and “closure” actually mean the same thing, although they can both refer to the same thing depending on context.

I’ve made this answer community wiki, so please feel free to edit it until it’s correct.

callback

closure

  • http://en.wikipedia.org/wiki/Closure_(computer_science)

    The term closure is often mistakenly used to mean anonymous function. This is probably because most languages implementing anonymous functions allow them to form closures and programmers are usually introduced to both concepts at the same time. These are, however, distinct concepts

Paul D. Waite
-1 The question was not what these terms mean but what keywords to use for them.
Tomas
Right, but if you don’t know what they mean, how do you know what keywords to use for them? The question seemed to suggest that they were synonymous, and they’re not.
Paul D. Waite
A: 

I think Function Pointer can be used as tag for "callback" or "closures".

Padmarag
A: 

I consider "Closures" and "Callbacks" related but nowhere equivalent. The lowest common denominator between the two I would say are "Higher-Order Functions", which take place in "Functional Programming".

http://en.wikipedia.org/wiki/Higher_order_functions

http://en.wikipedia.org/wiki/Functional_programming

trinithis