- 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.
- Python科學(xué)計算(第2版)
- Git高手之路
- Python進(jìn)階編程:編寫更高效、優(yōu)雅的Python代碼
- Mastering Scientific Computing with R
- Bootstrap Essentials
- PostgreSQL 11從入門到精通(視頻教學(xué)版)
- GameMaker Programming By Example
- HTML5與CSS3基礎(chǔ)教程(第8版)
- Node.js開發(fā)指南
- Programming Microsoft Dynamics? NAV 2015
- 算法圖解
- Java EE項目應(yīng)用開發(fā)
- JavaScript Mobile Application Development
- Implementing Splunk(Second Edition)
- Scratch 3.0少兒積木式編程(6~10歲)