官术网_书友最值得收藏!

  • JavaScript Concurrency
  • Adam Boduch
  • 309字
  • 2021-07-30 09:48:38

Chapter 1. Why JavaScript Concurrency?

JavaScript is not a language associated with concurrency. In fact, it's frequently associated with the exact opposite—concurrency challenges. This has changed a lot over the past few years, especially with new language features in ES 2015. Promises have been used in JavaScript for many years; only now, they're a native type. Generators are another addition to the language that changes the way we think about concurrency in JavaScript. Web workers have been in browsers for several years, and yet, we don't see them used that often. Perhaps, it has less to do with workers and more about our understanding of the role that concurrency plays in our applications.

The aim of this chapter is to explore some general concurrency ideas, starting with what, exactly, concurrency is. If you don't have any sort of concurrent programming in your background, it's fine because this chapter is a perfect starting point for you. If you've done concurrent programming in the past using JavaScript or some other language, think of this chapter as a refresher, only with JavaScript as the context.

We'll wrap up this chapter with some overarching concurrency principles. These are valuable programming tools that we should keep in the back of our heads while writing concurrent code. Once we have learned to apply these principles, they'll tell us whether we're on the right track with our concurrency design, or that we need to take a step back and ask ourselves what we're really trying to achieve. These principles take a top-down approach to the design of our application. This means that they're applicable from the very start, even before we've started writing any code. Throughout the book, we'll be referring to these principles, so if you only read one section in this chapter, make sure it's Concurrency principles at the end.

主站蜘蛛池模板: 浏阳市| 七台河市| 赣州市| 大石桥市| 京山县| 兰坪| 图木舒克市| 深州市| 南木林县| 白河县| 黄梅县| 游戏| 石屏县| 麻栗坡县| 大足县| 德兴市| 金寨县| 鄂温| 阿拉善右旗| 乌鲁木齐市| 洱源县| 甘泉县| 通河县| 东丰县| 宿松县| 太仆寺旗| 寻乌县| 封丘县| 林口县| 偏关县| 宝鸡市| 阿拉善右旗| 辽中县| 广南县| 阜新市| 宣汉县| 平湖市| 喀什市| 达拉特旗| 白朗县| 九龙城区|