What I couldn't learn in 2 hours reading about promises, it all made sense in 14 minutes watching this video. I had one of those Wow experience here. Thank you very much man your teaching techniques works thumbs up
Ntokozo Nkosi Nice! Yeah, one of the reasons I do videos instead of blogs, is I find a lot of topics MUCH easier to learn via video instead of blog or slide presentation. Glad it helped you!
Will, you are a rock star! You've saved my life again... I'm using Sequelize as my ORM on a current Express project. Sequelize uses promises throughout, but the examples don't help you understand promises if you don't already know how they work. I wanted my API routes and my Sequelize models decoupled, so I could support multiple database platforms for development, testing and production. My searches on Stack Overflow sent me down the callback path, but it just looked too confusing to me. A RUclips search on "javascript callback functions" showed this video fifth or sixth in the list, and I went straight here, because Will. 15 minutes later, my decoupling is working better than I envisioned! I've said it before and I'll say it again...you are a masterful communicator. Thank you...
Amazing tutorials, you are probably the best I've seen regarding teaching coding in general. Very knowledgeable, interesting and great at explaining. Feels like I'm learning from a real professional! Thank you!
Very clear explanation! Man, it is truly important to have a right mentor and materials when you learn programming. Because when it is explained in such a way you do it, all these complicated JS concepts become easy. I really enjoyed this tutorial. P.S. In such moments I wonder why RUclips doesn't have a triple like button!
Nice video, thanks a lot for this class! The only inconvenience I see with GENERATORS is that it is easier to get lost. The PROMISSES .then() method makes me feel things are glued together, being easier to find out what depends on what. Generators don't bring this kind of visual clue. To more experienced developers, it is cleaner and beautiful, but my guess is novices will have a hard time using generators!
I was just thinking that today! A new app I'm working on is in Koa, so I was converting code to generators...It got WAY cleaner, but I kept thinking I need to edit the syntax highlighting to make a yield line have a slightly highlighted background or something. A yield is a pretty big action that needs a clear visual cue.
10 лет назад+2
It will get easier as more code is written like that. It is just a paradigma shift. Nice video :)
I think that's a general problem with people who spend a lot of time behind books without a lot of real-world knowledge... Not to take away their skill/knowledge but IME they tend to over-complicate things. Not the case here of course!!
Shareonfb If you're referring to the old videos like this I had a plantronics headset mic that sounded about like a telephone...now I use a blue showball - MUCH better.
When talking about promises on the server, you often say that a function will be waited on until it gets a response before calling .then(). Doesn't this abolish the point of async? Will the code be blocking if the response does not come through immediately? What would happen if the .get('data.json') took 5 seconds to complete?
Once again, your videos do what about a hundred articles and other videos failed to - use the right examples to show the concept. Using jQuery Ajax calls is GENIUS since it's so much easier to conceptualize about the fact that the success function won't be called UNTIL AND UNLESS the ajax call has finished successfully. Thank you thank you thank you! I just got unstuck.
New to web development here. Will generators become the new best practice when dealing with Async code? I ask this because the generator code look unbelievably clean, which is a very important thing.
I certainly hope so. My company has adopted them completely on the backend with node.js On the browser side, adoption will grow as browser support grows without needing traceur. I know Chrome supports it now...not sure what else.
in the last part of the video with generators, how is it not blocking - yield will wait for the promise to resolve - so if i write a click handler below that - it will not go over to the click handler untill it comes out of that IIFE with all the yields
Hi there thanks for your tutorial! Is clean callbacks asynchronous? Isn't each function waiting for success before moving on to the next block? Edit. I checked the docs for $.ajax and I think it's async by default?
Very good explanation, however it seems that promises are way better than generators, since changing a file syntax and separating chained events is a mess and counter intuitive.
Didn't make sense to me - isn't the whole point of async that you can tell it to get multiple things simultaneously? The way it's explained here implies that it will wait before executing the next get.
Why have then((success)=>{...}, (fail)=>{...}) if the fail part is never used? Nobody is using the fail, any error handling is in the catch. But why have the fail function in the then? What does it do?
LearnCode.academy Thanks for the video! I have just a question. With this method can I plot two graphs one after the other without freezing the screen? Example: plot first graph, then compute data for second graph and when it's finished plot second graph in another letting the user scroll the screen after the first graph has been plotted. Because when I try it simply does not work. The screen still freezes or does not plot the second graph.
Idrees Samim unfortunately, anytime you are doing heavy computations (as compared to http requests - in which javscript isn't calculating, it's waiting on a server response), the browser will lag. Now, if you're using ie10+, you can potentially use a web worker to do this JS calculation in the background, which would alleviate page lag.
+Don Richards Most JS devs, either only-understand-jquery for async or use-to-use-it, so it was my choice for using something that everyone understands in order to talk about concepts that really don't have to do with any library..
Sadly this give a false sense of the environment to be completely frank. “If you can't explain it to a six year old, you don't understand it yourself.” ― Albert Einstein Breaking the purpose of the tutorial to its primitive basics and walking people through it that way gives a deeper understanding and clearer picture. I watch a lot of tutorials. This is the biggest flaw/turnoff/distraction. It's hard to tell what is jQuery and what is Javascript. The title being Async Javascript, these are the 2 i'd expect and nearly nothing else. Just a thought. Not trying to troll! Just hoping to help
No, I get what you're saying, no worries here. The reason is simple, almost every dev uses libraries for AJAX. I almost never see devs using native XMLHttpRequest. And by almost never, I pretty much mean never...the spec is just messy. The most popular async/AJAX library BY FAR is jQuery, as compared to axios, superagent, etc, so I opted for the most common ajax library of all time. For those using axios, superagent, etc, the syntax difference is minimal at most.
Yeah, sorry about that. I hacked the Plunkr CSS to be as big of a font as could fit stuff on screen. The video will go up to 1080p, though, if you're on a decent sized monitor.
LearnCode.academy I am "new" to JS haha I felt going down jQuery lane was a bad idea - specially since the language has made some efforts to improve itself. I cringe when I see 2016-made tutorials using "var". Friends don't let friends var, now. But, again I see how it is important to help people make the transition to the newer constructs. It is challenging to join the JS 2016 Party at this point because there are so many ways to do One Thing and you are never too sure which one is the right one.
I've got one of those...I'm just lazy haha! I'd rather crank out more videos for you guys than take the time to setup a sweet mic and compress everything. Maybe I'm just making excuses haha.
You did mention deferred.resolve() and reject() but didn't cover how you would create a method and work with a new deferred() object, and how to turn an non-deferred function to one; similarly, normal non-promise function to a promise so you can invoke the promise chain. github.com/zenithtekla/serialscan/blob/master/Serials/pages/assets/client/js/format_proc.js Disclaimer: 1. there might be many ways to turn a function that returns something, into a promise. There might be better ways. 2. I totally understood your video. 3. But I need to have a good understanding of deferred() vs. promise(), and in regard to my inquiry above.
LearnCode.academy Hey, and now two weeks later I am a ES6 Wizard with Bluebird's library. Generators are so hot. Finally, Javascript that doesn't look a slow motion trainwreck! I am so much more productive using yield than of course callbacks, but even promises.
On The Brink by Anthony Mayfield Awesome! Yeah, they're really nice. There's several projects that I've been on where generators basically saved the project.
LearnCode.academy Nice. Yes Async can be such a headache sometimes, which is why I have been learning Go since they have nice backed in concurrency, but I love all the Node libraries, so hopefully Generators & future ES specs can solve some of those issues. Also, thanks for the speedy response! :)
LearnCode.academy Speaking of Async, I'm surprised you didn't mention the async library in this video at all! It's another solid way to tame spaghetti code
I was thinking the exact same thing .. What are your thoughts? I screwed up asynch in an interview so I really want to be sure if I'm using these patterns as an answer. Edit. I checked the docs for $.ajax and I think it's async by default.
He's actually not wrong. As a long time PC user and a Mac hater, the unix style command line functionality in macOS is pretty king. macOS is basically a Linux distro you don't have to mess around with to get working. I hate that it's nice. Still won't buy one, but gotta hand it to Apple, they hit the nail on the head here.
You Sir! ... Are legendary when it comes to explaining hard to understand stuff !
+Nishant Gupta Thanks a ton! Glad it helped!
What I couldn't learn in 2 hours reading about promises, it all made sense in 14 minutes watching this video. I had one of those Wow experience here. Thank you very much man your teaching techniques works thumbs up
Ntokozo Nkosi Nice! Yeah, one of the reasons I do videos instead of blogs, is I find a lot of topics MUCH easier to learn via video instead of blog or slide presentation. Glad it helped you!
Will, you are a rock star! You've saved my life again...
I'm using Sequelize as my ORM on a current Express project. Sequelize uses promises throughout, but the examples don't help you understand promises if you don't already know how they work. I wanted my API routes and my Sequelize models decoupled, so I could support multiple database platforms for development, testing and production. My searches on Stack Overflow sent me down the callback path, but it just looked too confusing to me. A RUclips search on "javascript callback functions" showed this video fifth or sixth in the list, and I went straight here, because Will. 15 minutes later, my decoupling is working better than I envisioned! I've said it before and I'll say it again...you are a masterful communicator. Thank you...
I've been watching your vids for over a year now. You rock. Thank you for posting :D
Callback refresher and more! Indeed, Generators looks cleaner - Thanks for the share and effort to do these professional videos!
The best and evolutionary approach to demonstrate necessity of promises and their next level abstraction. Great lesson!
***** Thanks!
One of the best videos on promises on youtube. Crystal clear. Thanks a lot.
Man you are the best Teacher ever! I like the way you explain EVERYTHING so clearly. You are definitely better than most university teachers.
Amazing tutorials, you are probably the best I've seen regarding teaching coding in general. Very knowledgeable, interesting and great at explaining. Feels like I'm learning from a real professional!
Thank you!
I am never satisfied with programming video tutorials. You Sir are the exception.
Very clear explanation! Man, it is truly important to have a right mentor and materials when you learn programming. Because when it is explained in such a way you do it, all these complicated JS concepts become easy. I really enjoyed this tutorial.
P.S. In such moments I wonder why RUclips doesn't have a triple like button!
This is UH-MAZING! Thanks a lot for explaining (successfully) the thing I've been stuck on for over a week. :)
This was clearly explained! Finally understood how promises work. Thank you! Subscribed ;)
Nicely and easily explained promises by taking a comparison with other ways of JS ASync.
Your video was helpful. Thanks.
Hahaha, "the code must go on", you rock Will!
Good Way , Better Way, Best way and Awesome way!!! - You nailed it neatly, mate
Nice video, thanks a lot for this class! The only inconvenience I see with GENERATORS is that it is easier to get lost. The PROMISSES .then() method makes me feel things are glued together, being easier to find out what depends on what. Generators don't bring this kind of visual clue. To more experienced developers, it is cleaner and beautiful, but my guess is novices will have a hard time using generators!
I was just thinking that today!
A new app I'm working on is in Koa, so I was converting code to generators...It got WAY cleaner, but I kept thinking I need to edit the syntax highlighting to make a yield line have a slightly highlighted background or something.
A yield is a pretty big action that needs a clear visual cue.
It will get easier as more code is written like that. It is just a paradigma shift. Nice video :)
Very helpful! Promises make so much sense now. Thank you!!
You are pretty awesome friend. Thanks for explaining all these concepts in a simple way
Thanks! I just refactored a bit of code and now its really beautiful (to me, at least)
Extremely good explanation, ta!
And the Nobel Prize in simplifying things and explaining hard things in an easy, understandable way goes to... wait for it... Will Stern!
+Kamil Latosinski Thanks Kamil!
I think that's a general problem with people who spend a lot of time behind books without a lot of real-world knowledge... Not to take away their skill/knowledge but IME they tend to over-complicate things. Not the case here of course!!
Great energy. Clear explanation. Thank you.
One video for all Async concepts. Super awesome....
love your tutorials man. thanks a lot!
I really love ur videos. Everytime I learn something gr8 about JavaScript here. Please keep post :D
Thank you sir!
Wow... this was easy to understand. Thanks dude.
"The code must go on!" - best youtube quote ever!
Finally understood these concepts.
The Code Must Go On!!
Every video of yours I watch, I get an "Aha!" moment. Even when I think I understand something.
+tmanley1985 oh awesome to hear. That's the goal...take the "aha" moments that sometimes took me years to stumble across and put them out there.
Nice Voice . Clear mind . Comfortable speed in speak. It is a cool video in js. THANKS a lot
+chuang xie Thanks and thanks for the comment!
That was crystal clear, thanks!
I liked the way you explained. Awesome.
The best promise explanation....THx
What mic do you use? Your voice quality is great!
Shareonfb If you're referring to the old videos like this I had a plantronics headset mic that sounded about like a telephone...now I use a blue showball - MUCH better.
nice! thanks!
Great Tutorial, Nice Explanation, Thanks a lot !!
Awesome tutorial, generators and promises...........great
That video explained a lot of good stuff. I do think you went overkill at the end tho
Nice video, and yep... guess generators will be my new js thing.
Great explanation ! Thanks
Omg this should go in the playlist lol. Awesome awesome videos. I like you your style
Just imagining what your es6 refactor would look like..
Awesome tutorial..Thanks!
Amazing video.. clean and clear :)
When talking about promises on the server, you often say that a function will be waited on until it gets a response before calling .then(). Doesn't this abolish the point of async? Will the code be blocking if the response does not come through immediately? What would happen if the .get('data.json') took 5 seconds to complete?
Awesome man, thank you
WOW!
Brilliant, thank you so much!!
Awesome video thank you!
Great Work
thanks, really good explanation
this is gold, thx a lot !
Good video. Sorry about your bruised rib.
nice tutorial... great job.
This video is beautiful
Once again, your videos do what about a hundred articles and other videos failed to - use the right examples to show the concept. Using jQuery Ajax calls is GENIUS since it's so much easier to conceptualize about the fact that the success function won't be called UNTIL AND UNLESS the ajax call has finished successfully. Thank you thank you thank you! I just got unstuck.
does the awesome method looks a lot similar with node.js module.exports you think?
New to web development here. Will generators become the new best practice when dealing with Async code? I ask this because the generator code look unbelievably clean, which is a very important thing.
I certainly hope so. My company has adopted them completely on the backend with node.js
On the browser side, adoption will grow as browser support grows without needing traceur. I know Chrome supports it now...not sure what else.
Hmm when I switch to the generators script it doesn't make the call. The traceur route returns a 404 error
Guess you got well :) Thank You Sir
in the last part of the video with generators, how is it not blocking - yield will wait for the promise to resolve - so if i write a click handler below that - it will not go over to the click handler untill it comes out of that IIFE with all the yields
the code must go on.. JS I LOVE YOU..
Hi there thanks for your tutorial!
Is clean callbacks asynchronous? Isn't each function waiting for success before moving on to the next block?
Edit. I checked the docs for $.ajax and I think it's async by default?
awesome stuff
this video is awesomeeeee!!
Very good explanation, however it seems that promises are way better than generators, since changing a file syntax and separating chained events is a mess and counter intuitive.
Didn't make sense to me - isn't the whole point of async that you can tell it to get multiple things simultaneously? The way it's explained here implies that it will wait before executing the next get.
Aren't promises, as shown here, really just a messier version of synchronous code?
Why have then((success)=>{...}, (fail)=>{...}) if the fail part is never used? Nobody is using the fail, any error handling is in the catch. But why have the fail function in the then? What does it do?
I loved the video
Why are only decent libraries working with promises?
Because they don't cause blocking.
+Darren King I can't remember what the context was of that anymore!
LearnCode.academy Thanks for the video! I have just a question. With this method can I plot two graphs one after the other without freezing the screen? Example: plot first graph, then compute data for second graph and when it's finished plot second graph in another letting the user scroll the screen after the first graph has been plotted. Because when I try it simply does not work. The screen still freezes or does not plot the second graph.
Idrees Samim unfortunately, anytime you are doing heavy computations (as compared to http requests - in which javscript isn't calculating, it's waiting on a server response), the browser will lag. Now, if you're using ie10+, you can potentially use a web worker to do this JS calculation in the background, which would alleviate page lag.
wonderful
Thx Bud.
But if this is a tutorial on Javascript why are you complicating it with jQuery?
+Don Richards Most JS devs, either only-understand-jquery for async or use-to-use-it, so it was my choice for using something that everyone understands in order to talk about concepts that really don't have to do with any library..
Sadly this give a false sense of the environment to be completely frank. “If you can't explain it to a six year old, you don't understand it yourself.” ― Albert Einstein Breaking the purpose of the tutorial to its primitive basics and walking people through it that way gives a deeper understanding and clearer picture. I watch a lot of tutorials. This is the biggest flaw/turnoff/distraction. It's hard to tell what is jQuery and what is Javascript. The title being Async Javascript, these are the 2 i'd expect and nearly nothing else. Just a thought. Not trying to troll! Just hoping to help
No, I get what you're saying, no worries here.
The reason is simple, almost every dev uses libraries for AJAX. I almost never see devs using native XMLHttpRequest. And by almost never, I pretty much mean never...the spec is just messy.
The most popular async/AJAX library BY FAR is jQuery, as compared to axios, superagent, etc, so I opted for the most common ajax library of all time.
For those using axios, superagent, etc, the syntax difference is minimal at most.
How sad is it that I keep trying to scroll his code screen to read the script?! God, been typing code all day..
Are you bad, good, better or best with Async JS? JS Tutorial: Callbacks, Promises, Generators Wouldn't that be blocking the code?
Simply wao!
we cannot see the code . i will go to the place you recommended.
Yeah, sorry about that. I hacked the Plunkr CSS to be as big of a font as could fit stuff on screen.
The video will go up to 1080p, though, if you're on a decent sized monitor.
@12:35 instantly knew what this keyword was doing and I think I think I came a little.
He lost me when he said jQuery.
Hah I hear you...just going shotgun blast at something everyone knows. And scary how many people still use $.ajax
LearnCode.academy I am "new" to JS haha I felt going down jQuery lane was a bad idea - specially since the language has made some efforts to improve itself. I cringe when I see 2016-made tutorials using "var". Friends don't let friends var, now. But, again I see how it is important to help people make the transition to the newer constructs. It is challenging to join the JS 2016 Party at this point because there are so many ways to do One Thing and you are never too sure which one is the right one.
Do you have a job in development?
Same for me. This video is not noob friendly :(
what are you supposed to use in place of $.ajax? new best practices??
dude your videos are awesome but I'm buying you a new mic.
Or you can stop using speex lol
Haha, noted!...I'll see what I can do.
lol this just made me think of the picture I saw of Chris Coyier and his mic setup. Shit is ballin.
5by5.tv/webahead/63
I've got one of those...I'm just lazy haha! I'd rather crank out more videos for you guys than take the time to setup a sweet mic and compress everything.
Maybe I'm just making excuses haha.
You did mention deferred.resolve() and reject() but didn't cover how you would create a method and work with a new deferred() object, and how to turn an non-deferred function to one; similarly, normal non-promise function to a promise so you can invoke the promise chain. github.com/zenithtekla/serialscan/blob/master/Serials/pages/assets/client/js/format_proc.js
Disclaimer: 1. there might be many ways to turn a function that returns something, into a promise. There might be better ways.
2. I totally understood your video.
3. But I need to have a good understanding of deferred() vs. promise(), and in regard to my inquiry above.
Async/await does the same thing.
When I first saw this video 10 months ago it was pretty far out. Now it seems pretty basic to me lol. ^_^
Nice! Yeah none of this stuff is black magic...it's just that new syntax is always freaky at first.
LearnCode.academy Hey, and now two weeks later I am a ES6 Wizard with Bluebird's library. Generators are so hot. Finally, Javascript that doesn't look a slow motion trainwreck! I am so much more productive using yield than of course callbacks, but even promises.
On The Brink by Anthony Mayfield Awesome! Yeah, they're really nice. There's several projects that I've been on where generators basically saved the project.
LearnCode.academy Nice. Yes Async can be such a headache sometimes, which is why I have been learning Go since they have nice backed in concurrency, but I love all the Node libraries, so hopefully Generators & future ES specs can solve some of those issues. Also, thanks for the speedy response! :)
LearnCode.academy Speaking of Async, I'm surprised you didn't mention the async library in this video at all! It's another solid way to tame spaghetti code
How is callbacks.js asynchronous if it's waiting for success to to initiate the next AJAX request?
I was thinking the exact same thing .. What are your thoughts? I screwed up asynch in an interview so I really want to be sure if I'm using these patterns as an answer.
Edit. I checked the docs for $.ajax and I think it's async by default.
Good video but you shouldn't use jquery, in my opinion.
+Alique Williams The biggest reason I use jQuery is because almost every dev knows it and almost every Jr dev probably ONLY knows it.
LearnCode.academy If someone only knows jquery, then they're not even remotely qualified to learn anything in this video.
This is a Jquery promises tutorial and NOT Javascript promises
did I just hear jQuery?,,,....BYE BYE 👋🏻
Literally every single fucking web developer has a mac. wtf? You'd think someone with at least _some_ advanced technical knowledge would know better.
Because it has both the advantages of unix and a well designed user experience, out of the box.
wow #gay #brainwashed
He's actually not wrong. As a long time PC user and a Mac hater, the unix style command line functionality in macOS is pretty king. macOS is basically a Linux distro you don't have to mess around with to get working. I hate that it's nice. Still won't buy one, but gotta hand it to Apple, they hit the nail on the head here.
But everything just _works_ with windows
+Shrek Thetroll except bash
One of the best videos on promises on youtube. Crystal clear. Thanks a lot.
Great Job