We’ve talked before about using Promises to write better asynchronous code and avoid “Callback Hell”, but it’s always a struggle to come up with a good example of Promise code that doesn’t feel super contrived.
BUT! Recently I made an update to the Duck Creek Content Exchange project that involved a change to one piece of logic in the middle of a chain of operations. In this moment, I knew my perfect Promise example had come.
Then I had to make yet another change that involved turning a simple synchronous operation into one that involved sometimes calling a third-party API, and I knew I made the right choice.