Тёмный

The Power of JS Generators by Anjana Vakil 

JSConf
Подписаться 283 тыс.
Просмотров 167 тыс.
50% 1

Generators have been around in JavaScript since ES2015, yet remain largely ignored by many JS devs, who don’t see why or how they’d use them in their day-to-day work. But generators - which we can think of as special functions whose execution can be “paused” and resumed later on - are actually extremely powerful tools for producing and consuming series of data. That makes them perfect for implementing lazy sequences, custom iterables, animation, even the convenient asynchronous programming we now enjoy with “await”! In this talk we’ll dive into how JS generators work, what makes them so powerful, and why you should care.
jsconfbp.com/s...
About Anjana:
Anjana suffers from a chronic case of curiosity, which led her from philosophy to English teaching to computational linguistics to software development. These days she mostly codes & teaches from her home base in San Francisco, but she’ll always be a traveler at heart. Nerd out with her about functional programming & JavaScript, ask her about the Recurse Center & Outreachy, and definitely invite her to your karaoke party!

Опубликовано:

 

27 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 186   
@Play_Streams
@Play_Streams 2 года назад
I love her energy. Great presentation too! I've always struggled understanding generators.
@samuelmorkbednarzkepler
@samuelmorkbednarzkepler Год назад
Bro got that Einstein e=mc2 rizz 👀
@ilearnedtoday6014
@ilearnedtoday6014 2 года назад
she is back
@tikendying
@tikendying 2 года назад
Folks been waiting for her like a star wars trilogy
@Hunt92
@Hunt92 2 года назад
Exactly my thought every time i see her in a video
@miloslazic3636
@miloslazic3636 2 года назад
@@bradyfractal6653 She is just excited and happy to be presenting.
@dianyuanda3383
@dianyuanda3383 2 года назад
I've never seen any speaker in a tech conference that talk so enthusiastic like her
@rishabhkalra9505
@rishabhkalra9505 2 года назад
Finally we have a great explanation to generators. I knew about these for quite some time but since they are not much used, had limited knowledge on how to make them work with complex things, especially async ones. Great session.
@ShripadaHebbar
@ShripadaHebbar 3 месяца назад
As always, her presentation is amazing!. One small observation: Actually the cardDeck, can be expressed in a purely functional way, as the generators returned by generator function are iterable as well as iterator: const cardDeck = function* () { const suits = ["♣", "♦", "♥", "♠"]; const court = ["J", "Q", "K", "A"]; for (let suit of suits) { for (let i = 2; i
@khushalbhardwaj6192
@khushalbhardwaj6192 2 года назад
just fascinated how can something that's so under talked and underrated small little thing can be this powerful and cool.
@hello2131991
@hello2131991 2 года назад
Her energy is unmatched
@shegsdev
@shegsdev 2 года назад
Big fan of Anjana. Good to see her again.
@phoneix24886
@phoneix24886 2 года назад
Anjana is very energetic which makes the presentation interesting!
@chhavimanichoubey9437
@chhavimanichoubey9437 Год назад
I can't believe that this video helped me understand generators better than anything I ever saw or read on generators.
@damians.7859
@damians.7859 2 года назад
Such a nice talk, it's a shame that the person that editted it made a lot of cuts when code was presented and instead showed audience from the back...
@N32-e1g
@N32-e1g 2 года назад
idk what are u talking about
@4ipon4ik
@4ipon4ik Год назад
@@N32-e1g approx. 20:15 - 22:30 she explains her code step by step, but we don't see it because it's zoomed out.
@N32-e1g
@N32-e1g Год назад
@@4ipon4ik anyway u can't learn js by watching conferences
@4ipon4ik
@4ipon4ik Год назад
@@N32-e1g idk what are u talking about
@rollandbryan9908
@rollandbryan9908 2 года назад
Brilliant talk. Please keep the code being talked about on the screen!
@meljones2922
@meljones2922 2 года назад
Yup! Here's the code/slides observablehq.com/@anjana/the-power-of-js-generators
@ShubhamKumar305
@ShubhamKumar305 2 года назад
I've read about the iterators and iterables from MDN and since then I was like, now I know what can be iterated on JS and how. And when I read about generators I was like, yeah they are there, but how to effectively use them. Thank you Anjana for showing us the various ways.
@VKD007
@VKD007 2 года назад
I studied generators few years ago but this explanation is so fun man
@stevekyhon
@stevekyhon 2 года назад
Watched from the beginning to the end. Good stuff!
@AnthonySherritt
@AnthonySherritt 22 дня назад
Wow she's exceptional.Great job on this presentation!
@bmehder
@bmehder 2 года назад
Anjana's talks are always bangers.
@ZiedHF
@ZiedHF Год назад
Love her energy, what a beautiful soul. Thanks for this wonderful presentation!
@user-dk5uv1xy5j
@user-dk5uv1xy5j 2 года назад
We want more conf with her !
@phanCAbe
@phanCAbe 2 года назад
This is a great talk! However I always think back to the JS platform docs at my second job (at a very large company).... " Generators: Don't use generators." And it still makes sense because no matter what you do you'll always end up with code that's "too clever".
@schobihh2703
@schobihh2703 2 года назад
thanks!
@anikets4699
@anikets4699 2 года назад
😂🤣😅
@jincyquones
@jincyquones 2 года назад
"too clever" a.k.a. requires prerequisite knowledge of how they work, which most devs lack because they're too scared to use them
@RamkrishanYT
@RamkrishanYT Год назад
Bruh how is this too clever? It literally is explained in a 30 minute talk
@McQuinTrix
@McQuinTrix Год назад
+1
@taz2392
@taz2392 2 года назад
I have no idea what she’s talking about but it looks cool
@pavelmikhadiuzk310
@pavelmikhadiuzk310 2 года назад
she is crazy)) and Is it contagious) It spreads) I even see how I shout "Generators!" in the middle of night while I am sleeping
@michalkotlicki4710
@michalkotlicki4710 2 года назад
She becomes more energetic every time she takes a sip of this "water".
@oleanddro
@oleanddro 2 года назад
Excellent presentation of GENERATORS! (who saw the introduction will understand) Great energy of Anjana Vakil! Thanks!
@code_react
@code_react 2 года назад
No doubt its very useful but Why would you switch camera while she is explaining the code 20:15. :(
@alvarobyrne
@alvarobyrne 2 года назад
yeah, producer was sleeping or editor mistake, or what?
@lavendercode
@lavendercode 2 года назад
Thank you for speaking in this video. I have never heard of generators but now I am curious. Thank you.
@mahmoudaldawleh1982
@mahmoudaldawleh1982 2 года назад
i love her energy😃
@TheLexuguin
@TheLexuguin 2 года назад
You've been using them without even knowing it. Async/Await are basically syntactic sugar for generators. Before them, to achieve a similar functionality, you had to use generators.
2 года назад
awesome Anjana Vakil, thanks for this masterclass
@moosesnWoop
@moosesnWoop 2 года назад
Great to see Anjana again, wow.
@kevinrobertandrews
@kevinrobertandrews 2 года назад
Taking from infinite sequences absolutely blew my mind! Thanks for sharing 😊
@qodesmith520
@qodesmith520 2 года назад
At 2:38 she says "duck-duck-go'ing them..." #BOSS
@rahulkanyal
@rahulkanyal Год назад
Her energy and enthusiasm is mind-blowing.
@Thanadit231
@Thanadit231 2 года назад
love her power
@rojonali3374
@rojonali3374 2 года назад
Definitely she is amazing 😊
@zokizuan
@zokizuan 2 года назад
Thanks Anjali for showering us with your...
@spiral5799
@spiral5799 2 года назад
She is amazing, fun, smart, and beautiful
@angelbates5672
@angelbates5672 5 месяцев назад
Wow, this is such a great video. Thanks so much!
@ravierkonan1694
@ravierkonan1694 2 года назад
Knew Anjana from her talk on Functional Programming. On her way to be the public voice of JavaScript.
@Glibenko
@Glibenko Год назад
I really appreciate your performance. Now I know more about generators and wanna apply them.😎
@iliyaskhan3803
@iliyaskhan3803 2 года назад
Anjana knows the best way to engage all your senses
@amarwavare711
@amarwavare711 2 года назад
She made generators quite simple to understand !
@mich_thedev
@mich_thedev Год назад
One of the best speakers.
@espectropolitico
@espectropolitico 2 года назад
You're like an Marvel Superhero, but to JS. Trully saved me a day (again).
@mdistiakhossain1035
@mdistiakhossain1035 2 года назад
She is back again
@thoril.pegason
@thoril.pegason 3 месяца назад
Wow this is very cool!
@adittttya
@adittttya 2 года назад
Amazing stuff! One of the best talks ever! 🙌
@hajiamano22
@hajiamano22 2 года назад
Generators are so underutilized. I created a javascript framework with them that let's me build web apps in 1/10th of the time it took me before.
@Ty-13
@Ty-13 2 года назад
Is it open source?
@hajiamano22
@hajiamano22 2 года назад
@@Ty-13 Not currently, and there are a lot of reasons for that. One there are a lot of better frameworks out there more suited for speed that people should consider like solidjs. My framework is different. It doesn't have custom components, just pre-built components that all fit together in a grid system. The cool thing is getting data from the user happens synchronously. So you don't need to have call back functions for forms. When it's on the screen the program yields and waits for the form to be submitted before continuing execution
@nitsanbh
@nitsanbh 2 года назад
Good code is clear, not tricky. Implementing a bidirectional channel using a proper object would be so much more readable (and customizable) than using generators’ .next tricks
@vytenisurbonavicius9593
@vytenisurbonavicius9593 11 месяцев назад
Great presentation and great energy! Regarding generators - it might be just me but it still feels to me like generators are a cool yet much less readable way to do stuff. Yield makes code run in a non-linear and less intuitive fashion. I wonder if it is just me...
@phytonprogrammer1998
@phytonprogrammer1998 2 года назад
Happy to see you again 💜💜
@soltsdev
@soltsdev 2 года назад
legend is back
@edgeeffect
@edgeeffect Месяц назад
Cool... I've seen some really stupid negative comments on some of her other talks but the Anjana fan club is out in force on this one... as it should be.
@AvanaVana
@AvanaVana 2 года назад
I thought I understood generators. This blew my mind.
@oleksandrvorovchenko8674
@oleksandrvorovchenko8674 2 года назад
Great presentation! Thanks!
@chhiringtamang7875
@chhiringtamang7875 2 года назад
HOT NEW FEATURE FROM 6 YEARS AGO 🤣 BTW loved it.
@vladislavpeev5822
@vladislavpeev5822 2 года назад
Quality content, but I needed to slow down the video speed a little :D
@mehdi-vl5nn
@mehdi-vl5nn Год назад
The problem with those who lack computer education is exactly this. The order is actually like this: Stackless coroutines, event loops, self-suspending functions, iterators, simpler syntax generators, coroutines with simpler syntax, async functions, tasks, promises or futures. But wait, my dear friends. Promises in JavaScript have nothing to do with promises in reality. They are actually a function that puts itself in a queue! JavaScript's foolish features insult the spirit of programming and computer science.
@Rene-tu3fc
@Rene-tu3fc 2 года назад
not sure if python stole from js or the other way around, but they seem to look and function identically. very fun to use, but easy to create unreasonable code imo.
@sandro6103
@sandro6103 2 года назад
She is fire 🔥
@prigithjoseph7018
@prigithjoseph7018 2 года назад
Still need to be explain, what is the easiest way of implementing data science and Machine learning with js, and to more often a offline ide for such purpose.
@misterl8129
@misterl8129 8 месяцев назад
Anyone make the Starwars example work? I cant. How it is working? How i can console.log the object starwars with all the data? Thanks
@limitless9483
@limitless9483 Год назад
great talk btw you guys could have at least linked up the resources from the end of the video to your descriptiopn
@mknijnenberg85
@mknijnenberg85 Год назад
What is the tool/website called where Anjana makes her code blocks with?
@sudheerpoojary8975
@sudheerpoojary8975 2 года назад
nice explanation
@mohammedkaif1236
@mohammedkaif1236 2 года назад
AWESOME
@SuperQuwertz
@SuperQuwertz 11 месяцев назад
21:30 I want to see the code...
@savi_sandbox
@savi_sandbox 2 года назад
is there a way to download the slides, presented in the video?
@Hoppi1001
@Hoppi1001 2 года назад
Would it be possible to get those code snippets from somewhere? Yes, I can copy from the screen but maybe I can save some typing if it is.
@soumen_pradhan
@soumen_pradhan 2 года назад
observablehq.com/@anjana/the-power-of-js-generators
@omgd00d
@omgd00d 2 года назад
observablehq.com/@anjana/the-power-of-js-generators
@anastasiiasolop6653
@anastasiiasolop6653 2 года назад
the link was on the screen in the beginning observablehq.com/@anjana/the-power-of-js-generators
@rdil
@rdil 2 года назад
The slideshow is linked at the beginning of the talk.
@user-df1gs1kf8w
@user-df1gs1kf8w 2 года назад
Get a mac
@SachinDolta
@SachinDolta 2 года назад
Welcome back Anjana
@pahrurozi
@pahrurozi 2 года назад
What is music intro?
@mohammedkaif1236
@mohammedkaif1236 2 года назад
awesome
@kishorrathva4097
@kishorrathva4097 2 года назад
How does event loop handles it?
@yoni532s9M5w
@yoni532s9M5w 2 года назад
Why isn't js pressed about using generators for iteration like c# is? Isn't enumeration of entire arrays really bad in general?
@marekk9008
@marekk9008 Год назад
Whoever was a camera man did a very poor job... Why would you switch the camera from the screen when the speaker is showing snippets of code??? Makes this kind of videos much less useful later...
@N32-e1g
@N32-e1g 2 года назад
i'm not sure why do we need to use them
@pszznm
@pszznm 2 года назад
I don't feel like this talk was particularly useful, as most of the examples could be done easily without generators. Especially the ping-pong was plain stupid as it weren't the generators that enabled to circumvent maximum call stack size, it was the queue + run function.... I really hoped to learn something good here... Anyway, to me, the only thing that makes generators worth it, is logic and I/O separation. It is something I needed to be able to write testable code that is heavily dependent on external factors like read/write, running external programs or communicating with them, etc... It is something I could not find any different reasonable solution for. There is nothing else I came to contact with for what I couldn't find simpler solution than generators.
@dc22199x
@dc22199x 2 года назад
Looks similar to php's generator, but basically this is mostly borrowed concept of disappearing pointers.
@SamruddhaShah
@SamruddhaShah 2 года назад
Like your energy
@microcodes6887
@microcodes6887 2 года назад
If you shows on the screen that's how it will execute then it will much better
@nhieljeff2156
@nhieljeff2156 2 года назад
this is straight up sorcery
@rushikeshbunge2945
@rushikeshbunge2945 2 года назад
Ah shit, here we go again
@stacksagar
@stacksagar 2 года назад
❤️❤️🔥
@singhi89
@singhi89 Год назад
Anjana is such a cool lady I am loving.
@workout.trending
@workout.trending 2 года назад
can anyone tell me how to learn javascript as fast as possible
@mikoaj1954
@mikoaj1954 2 года назад
don't fixate on learning as quickly as possible, this is wrong approach. Just write your own code, bc that's the only way to get better at solving problems with help of programming language of ur choice.
@madcalm2024
@madcalm2024 2 года назад
Only in practice on complex projects with many real-life featutes.
@workout.trending
@workout.trending 2 года назад
@@mikoaj1954 true thanks man
@cmntkxp
@cmntkxp 2 года назад
After. Functional javascript speech..
@abhishekshah7361
@abhishekshah7361 2 года назад
It feels like c# features are being ported to javascript
@madcalm2024
@madcalm2024 2 года назад
Please don't hide behind the code next time ))
@Randomguy48279xyz
@Randomguy48279xyz 2 года назад
👍
@NphiniT
@NphiniT 2 года назад
Is it just me or JavaScript is looking more and more like Python?
@NphiniT
@NphiniT 2 года назад
@@hermes6910 I ain't said nothing bruv 😹
@MrDebranjandutta
@MrDebranjandutta 2 года назад
What's the difference between a generator and a constructor!
@thiccboi6211
@thiccboi6211 2 года назад
The same difference between your monitor and your door mat
@franksonjohnson
@franksonjohnson 2 года назад
m*nads made me laugh at loud, wonderful
@JaafarScript
@JaafarScript 6 месяцев назад
i love u 🥰 🥰 🥰 🥰 🥰 🥰 🥰 🥰 🥰 🥰
@ankur7487
@ankur7487 11 месяцев назад
your overacting makes it hard to watch this video.
@yegupov
@yegupov 2 года назад
m-word hahaha!
@_zetrax
@_zetrax 2 года назад
and sold 😂
@abiabi6733
@abiabi6733 2 года назад
omg
@schobihh2703
@schobihh2703 2 года назад
Generator are one of things nobody really needs. Everything of this can be done by JS w/o it.
@carlospedroza2604
@carlospedroza2604 2 года назад
For performance reasons (memory in particular), and when dealing with huge collections, you might want to generate one value at a time instead of populating and committing to memory a million-sized array. Generators are the most concise and expressive way to achieve this in JS. So no, not everything of this can be done in JS w/o it, and the best way to implement this pattern in JS atm is with generators.
@schobihh2703
@schobihh2703 2 года назад
@@carlospedroza2604 I say, that it is not needed. You say, that this approach is better. That is a different discussion.
@wijionemaster1875
@wijionemaster1875 Год назад
@@schobihh2703 you wouldn't have async await w/o generators and it's not the only thing you woudn't have.
@m4tech686
@m4tech686 2 года назад
Javascript needs changes its coding style is primitive
@MohitKumar-so4yf
@MohitKumar-so4yf Год назад
Apan naam tameej se lo behan. Anajana vakil hai Aaanjanna Vakkkil nahi hai
Далее
Новый вид животных Supertype
00:59
Просмотров 74 тыс.
Self Taught Coders Don't Exist | The Secret Sauce
32:47
React for Two Computers | Dan Abramov
28:56
Просмотров 22 тыс.
Learn JavaScript Generators In 12 Minutes
12:11
Просмотров 176 тыс.
Advanced Async and Concurrency Patterns in JavaScript
39:43
Generators in JavaScript
22:16
Просмотров 48 тыс.