Robot Not a Dev? Pre-order Now
Not a Dev?

Misty Community Forum

Semantic debate: Callback vs. Event vs. Promise

What is your best/favorite definition of a Callback, Event, and Promise in relation to development?

Really curious what @markwdalton would say vs. @cp_sridhar vs. @sean.audley

1 Like

I had to read more on javascript for promise. In C, C++, Fortran. Callbacks in my view (apparently not in javascript users) simpler, a pretty much call-after a call. Think action you click on a button in a gui and it calls back a function to do a action. Also there are both synchronous and asynchronous callbacks. Event handlers when a event occurs it responds by looking at the event and does nothing or the appropriate function. And the history of callback is somewhat decent on the use/application. Event handlers are one type of callback others are in old GUIs for example.

But I don’t yet have comments on promise I would defer to others as below. I am just better in C, C++, python and think in threaded/mpi/gpu fully parallel coding. So I do most work on misty in those. So I defer to others.
Besides I have more basic issues I am trying to sort out in javascript :joy:

A nice history and use at:


Others

1 Like

I dunno @Ben… I’m a happy man as I’ve got the SDK in C# and we can do some manly manly software development with misty now :laughing:

I totally misread the question at first and was writing literally a bible for each of the terms and thought sod as your asking for links to definitions! At first I was get low down and dirty with using queues and stack manipulations with interupts but alas not required.

Anyways heres my humble opinion before i start doing some actual work!

The links @markwdalton found are exactly true to the point except don’t believe everything you read on wikipedia young man!

Promises provide a clear way of representing sequential asynchronous operations in the javascript framework. Although they have the same effect as callbacks the syntax is different and in terms of developing they are much more easier to read and maintain. Promises also comply to the IoC with regards to SOLID. This in my opinion makes them the goto approach in javascript.

1 Like

Thanks @sean.audley and @markwdalton! I like to ask these types of questions to understand how you approach things :slight_smile: