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

  • JavaScript at Scale
  • Adam Boduch
  • 291字
  • 2021-07-16 13:04:30

Chapter 3. Component Composition

Large-scale JavaScript applications amount to a series of communicating components. The focus of this chapter is on the composition of these components, while in the next chapter we will look at how these components communicate with one another. Composition is a big topic, and one that's relevant to scalable JavaScript code. When we start thinking about the composition of our components, we start to notice certain flaws in our design; limitations that prevent us from scaling in response to influencers.

The composition of a component isn't random—there's a handful of prevalent patterns for JavaScript components. We'll begin the chapter with a look at some of these generic component types that encapsulate common patterns found in every web application. Understanding that components implement patterns is crucial for extending these generic components in a way that scales.

It's one thing to get our component composition right from a purely technical standpoint, it's another to easily map these components to features. The same challenge holds true for components we've already implemented. The way we compose our code needs to provide a level of transparency, so that it's feasible to decompose our components and understand what they're doing, both at runtime and at design time.

Finally, we'll take a look at the idea of decoupling business logic from our components. This is nothing new—the idea of separation-of-concerns has been around for a long time. The challenge with JavaScript applications is that it touches on so many things—it's difficult to clearly separate business logic from other implementation concerns. The way in which we organize our source code (relative to the components that use them) can have a dramatic effect on our ability to scale.

主站蜘蛛池模板: 达尔| 高淳县| 锡林郭勒盟| 娄底市| 古交市| 定安县| 化州市| 黔东| 蓬莱市| 嘉义县| 洛南县| 申扎县| 伊川县| 丰宁| 宿松县| 剑阁县| 轮台县| 广元市| 诏安县| 温宿县| 淮阳县| 金平| 上林县| 宝清县| 兴城市| 广饶县| 香河县| 分宜县| 吴桥县| 交口县| 水城县| 同江市| 鹿邑县| 上思县| 孟连| 黄浦区| 太仓市| 雷波县| 江永县| 文昌市| 浦城县|