Promises and Generators

Evert Pot (18.Mar.2017 at 10:00, 50 min)
Talk at Midwest PHP 2017 (English - US)

Rating: 4 of 5

Many of you have heard of the concept 'Promise'. Some of you may even have used
it. The 'Promise' is a useful design pattern when developing applications that
have a strong asynchronous aspect and avoids what's called 'callback hell' or
'callback christmas trees'.

The promise is a bit hard to wrap your head around though. This talk will
explain exactly how a promise works and behaves and how you should interact
with it.

Next, we'll dig into generators. Generators have been added to PHP 5.5 and
Ecmascript 6 and makes creating and consuming iterators a lot easier.

Generators have a unique language property though. They allow us to jump in
the middle of any method outside that method. In the third part of the talk
we'll show how we can use iterators to improve promise-heavy code and make
asynchronous code look and behave as normal code.

Who are you?

Claim talk

Talk claims have been moved to the new site.

Please login to the new site to claim your talk

Comments closed.


Rating: 4 of 5

18.Mar.2017 at 10:49 by Jeremiah Sandahl (23 comments) via Web2 LIVE

Good lecture. Very dense with a ton of good information. I think I understand better what promises and generators are, though I still don't know what kind of use-case generators are good for.

Rating: 4 of 5

18.Mar.2017 at 10:49 by Woody Gilk (25 comments) via Web2 LIVE

Super interesting talk. The examples were good. I'm still not entirely sure how promises are implemented with regard to generators. A little more information to link the two concepts would be helpful. Or maybe I should just go read a promise implementation.

Rating: 4 of 5

18.Mar.2017 at 10:52 by Brian Fenton (71 comments) via Web2 LIVE

Lots of content, moved at a good clip. Did tend to say things like "obviously" and "simple" a lot, which may be off-putting to people who hadn't run into this paradigm before.

~Echoing Woody's comment... not sure the value we add by yielding from a promise vs. calling then.~

I asked. Terseness :)

Rating: 4 of 5

18.Mar.2017 at 10:53 by Nathan Klatt (21 comments) via Web2 LIVE

Fascinating talk, you obviously have a deep understanding of it. Had a hard time grasping how I might apply it but probably just the nature of the subject.

Rating: 4 of 5

18.Mar.2017 at 11:32 by Dave Buchanan (35 comments) via Web2 LIVE

Very informative with lots of really good examples. This is something new for me...except I needed this talk 3 months ago! Would have made doing thousands of api calls much faster. And I agree with others, would have like a couple more slides on how to use promises/generators together.

Rating: 5 of 5

18.Mar.2017 at 12:40 by David McKay (10 comments) via Web2 LIVE

Super informative and well delivered

Rating: 3 of 5

18.Mar.2017 at 12:44 by Antoinette Smith (6 comments) via Web2 LIVE

As Evert said, the pace of this talk was very speedy. I was OK with this during the promises overview as I use them all the time, but once the weird generator-behavior slides came in, I got pretty lost. Ultimately, the problem I wanted to solve was how to use generators to prevent long promise chains, but I am still unsure of how to do that. This might be because I got confused at the generator portion.

Rating: 5 of 5

18.Mar.2017 at 16:58 by Korvin Szanto (9 comments) via Web2 LIVE

Glad I made this talk! I have a lot of experience working with generators in PHP but not much working with promises so this was very helpful for me.

Rating: 4 of 5

20.Mar.2017 at 09:25 by Anonymous

A very good talk, but got lost at the end when all the ideas were put together.

Rating: 3 of 5

20.Mar.2017 at 09:51 by David Lim (12 comments) via Web2 LIVE

I don't have projects that need either of these two concepts yet, but will keep them in mind so I don't get into callback hell.

© 2019