- Mastering JavaScript Design Patterns
- Simon Timms
- 194字
- 2021-08-05 17:14:58
Summary
It has been said that there are only two really hard things in computing science. What those issues are varies depending on who is speaking. Frequently, it is some variation of cache invalidation and naming. How to organize your code is a large part of that naming problem.
As a group, we seem to have settled quite firmly on the idea of namespaces and classes. As we've seen, there is no direct support for either of these two concepts in JavaScript. However, there are a myriad of ways to work around the problem, some of which actually provide more power than one would get through a traditional namespace/class system.
The primary concern with JavaScript is to avoid polluting the global namespace with a large number of similarly named, unconnected objects. Encapsulating JavaScript into modules is a key step on the road to writing maintainable and reusable code.
As we move forward, we'll see that many of the patterns which are quite complex arrangements of interfaces become far simpler in the land of JavaScript. Prototype-based inheritance, which seems difficult at the onset, is a tremendous tool for aiding in the simplification of design patterns.
- CockroachDB權(quán)威指南
- Mastering SVG
- Dependency Injection in .NET Core 2.0
- JavaScript:Moving to ES2015
- Windows內(nèi)核編程
- 青少年信息學(xué)競賽
- 微服務(wù)架構(gòu)深度解析:原理、實踐與進(jìn)階
- Java Web開發(fā)就該這樣學(xué)
- Learning Unreal Engine Android Game Development
- SQL Server實用教程(SQL Server 2008版)
- Spring Security Essentials
- 計算機應(yīng)用技能實訓(xùn)教程
- Python預(yù)測分析實戰(zhàn)
- Android 游戲開發(fā)大全(第二版)
- 微信小程序開發(fā)邊做邊學(xué)(微課視頻版)