正文:
在今年的dotJS大会上,谷歌Angular负责人Minko Gechev发表了一场关于JavaScript框架未来的演讲,他提出一个激进的观点:所有JavaScript框架正在走向融合。
Gechev指出,虽然Angular和React在设计理念上有所不同,一个使用类和模板,另一个使用函数和JSX,但在核心层面,它们都旨在提供相似的功能和解决相同的问题。他表示,前端框架的大部分职责是保持模型与视图的同步,在这个方面,Angular和React显示出了设计上的相似之处。
Gechev还提到,React和Angular在保持组件树与UI同步方面有着惊人的相似性。他指出,无论是在更新购物车状态还是其他应用组件的使用,两个框架的变更检测和调和操作都采用了非常相似的算法。
在性能方面,Gechev通过基准测试展示了Angular和React的相似性。尽管在行交换方面表现不佳,但在局部更新方面,这两个框架都展现出了良好的性能。他表示,随着应用的复杂性增加,可能会有成百上千个组件持续处于活跃状态,这使得框架需要优化响应性机制。
为了解决这个问题,Angular引入了一种基于编译器的静态依赖追踪机制,并加入了Signals,一种响应性原语,可以自动跟踪它们被使用的位置。Gechev指出,其他框架如Ember、Solid、Vue、Svelte等也在响应性原语上走向融合。
此外,Gechev还提到Wiz框架,它被应用于与Angular截然不同的场景,更类似于Astro和Qwik。随着框架要求的融合,Wiz团队在看到Angular中的Signals后也想要在Wiz中引入,而Angular团队则想要Wiz的可恢复性特性。这导致移动版YouTube使用集成了Angular Signals的Wiz框架,在性能上实现了显著提升。
Gechev的这一观点预示着未来JavaScript框架的发展趋势,即它们将在技术上趋向统一,尽管在应用场景上可能仍有不同。这一趋势对于开发者来说,意味着在选择框架时,可以不必过度担心技术差异,因为最终它们都将成为同质的技术,只是外在形式有所不同。
英语如下:
News Title: “Google Angular Head: JavaScript Frameworks Are Heading Towards Convergence”
Keywords: Convergence, Framework, Google
News Content:
Title: Google Angular Head: JavaScript Frameworks Are Heading Towards Convergence
Body:
At this year’s dotJS conference, Google Angular head Minko Gechev delivered a keynote speech on the future of JavaScript frameworks, proposing an aggressive viewpoint: all JavaScript frameworks are moving towards convergence.
Gechev pointed out that while Angular and React have different design philosophies, with the former using classes and templates and the latter using functions and JSX, they both aim to provide similar functionalities and solve the same problems at their core. He stated that the majority of the responsibilities of front-end frameworks are to maintain the synchronization between the model and the view, in which Angular and React have shown design similarities.
Gechev also mentioned that there is an astonishing similarity between React and Angular in maintaining the synchronization between the component tree and the UI. He noted that both frameworks use very similar algorithms for change detection and reconciliation operations, whether it is updating the state of a shopping cart or using other application components.
In terms of performance, Gechev demonstrated the similarity between Angular and React through benchmark tests. Although they performed poorly in terms of line swapping, both frameworks showed good performance in local updates. He pointed out that as the complexity of applications increases, there may be hundreds or even thousands of components that remain active, making it necessary for the frameworks to optimize their responsiveness mechanisms.
To address this issue, Angular introduced a static dependency tracking mechanism based on a compiler and included Signals, a reactivity primitive, which can automatically track their usage locations. Gechev noted that other frameworks such as Ember, Solid, Vue, and Svelte are also moving towards convergence in reactivity primitives.
Furthermore, Gechev mentioned the Wiz framework, which is applied in scenarios completely different from Angular, similar to Astro and Qwik. As the requirements of the frameworks converge, the Wiz team, after seeing Signals in Angular, also wanted to introduce them into Wiz, while the Angular team was interested in the recoverability features of Wiz. This resulted in a significant performance improvement for the mobile version of YouTube by integrating Wiz with Angular Signals.
Gechev’s viewpoint suggests the future trend of JavaScript frameworks, which is towards technological unification, although there may still be differences in application scenarios. This trend means that developers can choose frameworks without overthinking the technical differences, as they will ultimately become homogeneous technologies, differing only in their external forms.
【来源】https://mp.weixin.qq.com/s/dAxiTD8tcM9DhHN76ZhaGw
Views: 1