Skip to content

Other, more striking callback issues are not mentioned #26

@PavelVanecek

Description

@PavelVanecek

Using callbacks comes with many issues and indentation with curly braces jungle is but one of them. By passing a callback you are passing the control over to a potentially buggy code with undesired behaviour.
The callback problems are:

  • callback can be called once, twice, infinitely many times, or never, and you have no control over it
  • callback can be called in synchronous or asynchronous fashion
  • callbacks swallow exceptions and force developers to conventions
  • callbacks make writing the curlybraced and indented code easy

I did not invent all of it myself, I learned a lot in YDKJS: https://github.com/getify/You-Dont-Know-JS/blob/master/async%20&%20performance/ch2.md

Yet the webpage only mentions the last one, from my point the least important one. Is it possible to at least mention that there are other, more serious problems, which actually turn this whole area into a real hell?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions