JavaScript Promises A+ “Anytime, Anywhere”

Screen Shot 2015-01-15 at 5.54.49 PM

Like Vasquez says: “Anytime, Anywhere”

tl;dr: here is the codepen

Expect all network communication to be asynchronous. You don’t know when requests will come back to you, and you likely have no idea what order they will arrive back. So you write your code asynchronously, same as you do in real life:

“Look, just get back to me when it’s done, ok?”

“Sure thing, I’ll call when it’s ready”

That’s all a Promise is – that conversation and that commitment. And they are a great design pattern to restore some sanity to asynchronous code.

Continue reading

The Software Event Model

This article by Ruben is a nice, jargon-free explanation of the AS3 event model, which applies to other languages in concept if not in syntax. It’s worth getting a handle on this powerful tool and also to keep in mind that it is not the only way to send signals between loosely couple objects in a software project. In fact the Signals and Slots methods used in other platforms such as Qt are very useful extensions of the event model. John Lindquist has a video tutorial using the AS3-Signals library for AS3 here. There is also Senocular’s post on the technical details of using the Event Model to handle how an event moves through you application