The odds and ends of this fragile scripting language
Run to completion
Every function runs to completion. This means you need to pay attention to the order of functions.
Challenges with Callbacks
A list for now
- Explicit seams - blessing and a curse
- seams rip accross program
- another, difficult error mechanism
- boilerplate error handling
- hard to reuse error handling logic
- difficult to understand
- never called?
- called multiple times?
- called synchronously?
- synchronizing parallelism is hard.
Writing code with promises does at least two things;
First - you realize that you are calling code with a low level of confidence. You give your code two sets of instructions. If you are able to do what I ask, great. Now please continue this path. However, I realize that things go wrong and you may not be able to provide me what I ask. In that situation, then please proceed in this other, error line.
Second - writing with promises provides a logical seam in your asynchronous code. My program will continue to run while you step out of line and do your thing. When you are done, you can come back but I need to keep the line moving.