No matter how much experience you have with JavaScript, odds are you don't fully understand the language. As part of the "You Don't Know JS" series, this concise yet in-depth guide focuses on new asynchronous features and performance techniques--including Promises, generators, and Web Workers--that let you create sophisticated single-page web applications and escape callback hell in the process.
Like other books in this series, You Don't Know JS: Async & Performance dives into trickier parts of the language that many JavaScript programmers simply avoid. Armed with this knowledge, you can become a true JavaScript master.
With this book you will:
Explore old and new JavaScript methods for handling asynchronous programming Understand how callbacks let third parties control your program's execution Address the "inversion of control" issue with JavaScript Promises Use generators to express async flow in a sequential, synchronous-looking fashion Tackle program-level performance with Web Workers, SIMD, and asm.js Learn valuable resources and techniques for benchmarking and tuning your expressions and statements
Kyle Simpson is an Open Web Evangelist from Austin, TX, who's passionate about all things JavaScript. He's an author, workshop trainer, tech speaker, and OSS contributor/leader.
This book dives deep into various techniques for handling asynchronous operations in JavaScript. In particular the simplicity and drawbacks of callbacks are outlined with suggestions to address them as the cost of added code complexity. The chapter on promises is one of the best that I've read and walks through great examples of chaining and the power of composing. The chapter on generators focuses on modeling asynchronous code in a more synchronous manner. I was unconvinced and found the code examples hard to follow or reason about. The chapter briefly mentions the proposed ES7 async/await syntax which makes more sense to me and can be used today with the Babel transpiler. The final two chapters on performance and benchmarking felt like blog posts primarily linking to other resources and best practices. The callbacks and promises chapters are must reads while most of the rest can be skipped and definitely ignore the author's ubiquitous self promotion of his asynquence library.
الكتاب الرابع من سلسلة أنت لا تعرف جافاسكربت. وأظنه أصعب الكتب أو أكثرها غوصًا في التفاصيل التقنية.
الفصل الأول يعرض الفرق بين التنفيذ المتزامن، غير المتزامن، والتنفيذ المتواقت للكود في جافاسكربت. وأقصد بها على الترتيب:
Synchrony, Asynchrony, Concurrency.
الفصل الثاني يتحدث عن أقدم أساليب كتابة الكود غير المتزامن وهي دوال الردود Callbacks ويتوسع في شرح مشاكل ومساؤى هذا الأسلوب.
الفصل الثالث يتحدث عن دوال الوعود في جافاسكرتب Promises وهي تحل كافة مشاكل دوال الردود في كتابة كود غير متزامن. وأهمها معكوسية التحكّم والموثوقية.
الفصول الثلاثة الأولى مفيدة للغاية، وأنصح بقرائتها لجميع المبرمجين. مع بداية الفصل الرابع وحديثه عن دوال المولدات Generators تبدأ التفاصيل التقنية الدقيقة والحديث المتشعب. هناك إشارة عابرة إلى دوال async/await بحكم القدم النسبي للكتاب رغم أنها أحدث الدوال الأكثر شيوعًا وسهولة للاستخدام اليوم في تأليف كود غير متزامن.
الفصل الخامس والسادس مخصص للحديث عن كيفية قياس أداء البرامج ونصائح وأدوات متعلقة بذلك. الملحقين الأول والثاني لم أستطع إكمالهما حقًا وهي متعلقة بشرح مكتبة من تأليف الكاتب نفسه تُدعى asynquence
وسيكون لي وقفة لاحقة معها في قراءة ثانية للكتاب لاحقًا. إن وجدت لذلك فائدة مرجوة
Quite technical, not at all light, very interesting read. Although understanding promises and generators is quite handy, the last part about advanced patterns is one of those things that I'm not sure when I'll end up using.
Still, while I personally appreciate knowing stuff, without worrying too much about when I'll find that knowledge useful, some more pragmatic folks will probably skip those parts (apendixes).
The chapter about promises is a little too preachy, promising that they will save us from callbacks...only to in the end, get to creating code that requires maybe a little too much mind bending.
Also, now it's december 2018. The async/await keywords made it to the language (maybe?...not sure..I write python most of the time). Many of the patterns in the book would be obsoleted by these new keywords. Those make async code look waaay more sync. Somehow I already met the async/await keywords in python and took them for granted. Without those, the world is a very dark place indeed, as illustrated by the many patterns and "workarounds" in this book.
All in all, if you appreciate perspective on promises and generators, this is a good book, though a little outdated.
O yeah, there is a random chapter here about performance... it was ok, but what's up with that? It was probably worth writing another book on that (maybe even shorter), but the author maybe wasn't in the mood for so much research. I can't blame the guy, there is a lot of information in the books in this series, after 6 books, the guy is exhausted :p (or maybe the publisher didn't approve? Dunno, but the chapter was random. He could have written about the performance of async operations I guess, but that was not the case :p
Good book! Discard the preachiness, and you'll learn lots of things
I have never imagined that there are so many concerns not with callbacks, but regarding promises as well.
Wonderful book on handling async requests via callbacks, promises and handling them via generators. Kyle looks ahead a bit into ES7 async\await features.
Last two chapters cover web performance, from general topics: Web Workers, SIMD, asm.js, to very specific ones: benchmarking pieces of js code, figuring out crucial path. I will definitely take a look at
La primera mitad se puede saltar si se entiende bien como funcionan las promesas, la segunda se pone mas interesante con los generadores y performance.
A fantastic exploration of what "async" means in the context of JavaScript. I was amazed at the depth of explanation provided especially for the Promises chapter. It is a gold mine in my opinion, one that I expect to be returning to again and again.
The author's take on Generators is pretty interesting. Though I must confess, after a while, it started going a little above my head. This only means that the text is dense and needs re-reading. This also makes me think how much of this can I apply in my day-job. Considering the goal of keep code readable/simple, I am not very sure I will be using Generators anytime soon. Async/await looks fantastic and will certainly be useful in Node.js based environments.
I expect Promises to be the bread and butter of all async code that I write, at least for the next year or so. I am grateful to Kyle for the fantastic content he has provided in this area.
Overall a good read, something that makes you mildly uncomfortable, but just enough so you keep pressing into more of the language.
Clear and easy to understand, this has helped me make sense of the often murky world of promises and generators.
It's very information dense but I found it easier to get to grips with by reading through a chapter and then going back and trying out the supplied code for myself.
The performance chapters didn't feel as in-depth as the rest of the book but they did cover a few little things that the JavaScript engine will do to your code without you knowing (eg unrolling recursion for you if it thinks a loop will run faster) and things that you shouldn't spend time worrying about (--x or x--). They also went into how to use (and not use) benchmarking tests for checking your own code.
I must admit I got a bit lost on the last appendix - advanced async patterns - but I think that's because I haven't had much real-life practice of the basics yet.
This book has massively improved my understanding and use of async JavaScript code. It's one that I will be adding to the limited collection I keep on my desk.
The most interesting thing today is that I got one question in my interview about Promise and it was covered in this book. A few things from the top of my mind: 1. Callbacks are no good, use them sometimes and avoiding nest them. For many async task, try using Promise. 2. Promise tends to swallow errors so use it with async/await 3. Optimization my code is more complicated than other devs suggest. Using jsperf.com or benchmarkjs to test my optimzation. There are more to this book that I have yet put into my mind but I don't have any plan to reread this one in foreseeable future. The appendixes are about the author library asynquence which I guiltily skipped since I don't have any intention to take a loot at it. For the 2 months, I think I will just focus on Promise and async/await function. Btw sorry generator function for misunderstanding you. You are the precursor for the new async/await (since 2014 I guess)
Every book in this series is a must-read for a Javascript dev. This one does not fail to deliver. The reason I choose to read this book is to learn more about how aysnc works in JS. I never really mentally grasped ASYNC with full confidence even though I've been using it for over 10 years. I would need to google the best approach for addressing deadlocks or race conditions.
This book definitely helped gave me a much fuller understanding of async. All the issues with callback, not just callback hell... why generators are good. Some subtle nuances with promises I had never considered before.
You should read this book because it is asy to read and understand. It covers the fundamentals so you will understand and you can design async solutions with a lot more confidence
This is the worst book I have read in my life so far.
It's about 5 times more verbose than it needs to be, making it clear that the entire series actually could have been a single book rather than a series... but gotta make bank right?
Besides the verbosity the author jumps back and fourth referencing both past and future chapters as well as repeating concepts over and over and over... The chapter on promises alone spans around 70 pages and could have honestly been compacted to about 20 or less.
This book is a waste of time and money, god I even blocked the author on Twitter just so that I never have to ever read another word from him again. Every minute was torture and I'm glad it's over.
This one seemed to me not as useful as previous ones from the series. But, still, it's rather useful. It contains a great explanation about what Promises is and why they were included in js. But apart from it, the book contains chapters about topics related to concurrency itself but not to JavaScript itself. I didn't find it useful, since I am quite familiar with the concept.
Also, the book contains a chapter about Generators and I must confess I didn't get it. It's not clear what problems they solve and why I need them.
To conclude, my advice is to read the first three chapters of the book. The others you can read on your own risk)
El más complejo de la serie sin duda. Tuve que regresar a él unas tres veces porque estoy tonto para entender bien el concepto de programación asíncrona. Al final se cumple el principio de que la programación solo se aprende practicando, y después de algunas horas experimentando con promesas, pude terminar el libro.
Al ser una edición vieja, ya hay tecnologías que facilitan mucho las tareas que el libro propone. Sin embargo, la raíz de los conceptos sigue siendo la misma, y la manera en que son explicados aquí son lo que puede aportar valor a cualquier programador que le dé una checada.
Amazing book if you want to understand how asynchronicity (or the illusion of asynchronicity) in JavaScript works. Kyle has a unique way of explaining deep technical CS concepts in a simple and straightforward manner. He lays down the differences between concurrency, serialism and parallelism and then use those differences to explain the JS Event loop and then goes into the technicalities of implementation using callbacks, promises, and generators. Finally, he gives some overview of assessing performance and benchmarking.
I really liked building an understanding for promises and async/await in javascript. One thing that I had never seen before was generators which is the underlying magic behind asynchronous programming in javascript. It was cool to understand that better. The performance aspect of the book could have been more fulfilling but I guess if you're using javascript you probably don't care that much about performance anyway.
This whole series is awesome. Having read several JS books, it was nice to have a really comprehensive technical treatment on these topics. These books read really well, and somehow manage to be engaging at the same time as being very thorough.
One thing I really like about this book, is that since it is open-sourced and available on GitHub, I can easily reference it when any questions come up about these topics.
Callbacks, promises and generators. All things asynchronous. No reservations about the quality, but it was a bit boring. Among the books from the YDKJS series by Simpson, even though async operations is are hugely important in frontend programming, this one I liked probably the least and likely will not return to it and will use other resources for this topic. I skipped the addendums about asynquence library authored by Simpson, because it did not seem relevant anymore.
The last chapter on performance is a complete dud which could be summarized in a single paragraph. Some of the chapters are overtly long but still exhaustive so 4 stars unless I find a better book on this topic.
The first appendix was unnecessary (perhaps the second one as well), the Promise's chapter did get repetitive (but it was still good), and I wish he had gone deeper into performance. Still not a bad book though, worth reading.
This book ended up more low level than I had expected. Coming in without much of an understanding of generators and async/await, I ended up having to consult outside sources more than I'd have liked, just to be able to follow along with what the writer was talking about.
All the books in the series are quite verbose - over-explanation with analogies doesn't always make it easy to understand concepts. "Async & Performace" title doesn't get concurrency and parallelism right. Rest, it does do a good job of explaining JS's quirkiness.
I don't know why I didn't read this book earlier, for weeks I've been lost with all the "Async-Await" tech talks and now this book, eloquently written offers a clear and consice explanation.
The book itself is good. The only the part I didn't like was about the asyncquence library. I felt it was out of the scope of JavaScript core features. Apart from this book is amazing.
One of the best resources for learning the ins and outs of JS asynchronous programming and Promises. Some really great insight about JS performance and benchmarking too!
The best book about javascript I've read in which concerns to async and performance! Learned a lot of new things I didn't know and didn't find in another place.