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

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.

主站蜘蛛池模板: 三亚市| 沾化县| 玉田县| 吴桥县| 宣城市| 光泽县| 咸宁市| 山阳县| 丰宁| 嘉善县| 隆回县| 石嘴山市| 奉新县| 那坡县| 炎陵县| 诸城市| 无棣县| 和龙市| 柘荣县| 榕江县| 共和县| 建昌县| 民乐县| 勐海县| 花垣县| 弥勒县| 萝北县| 汽车| 德江县| 娄底市| 巴林左旗| 东乌| 秭归县| 阿巴嘎旗| 岑巩县| 沾化县| 洛南县| 金山区| 蓬溪县| 舒兰市| 商水县|