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

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.

主站蜘蛛池模板: 县级市| 阿勒泰市| 沂水县| 磐安县| 石屏县| 惠安县| 宝清县| 蛟河市| 鄄城县| 伊春市| 德昌县| 扬中市| 台北县| 宜昌市| 杂多县| 张北县| 南川市| 隆回县| 遵义市| 河南省| 南充市| 峨边| 扎鲁特旗| 临高县| 旬阳县| 白山市| 荔浦县| 体育| 松阳县| 宁南县| 福海县| 徐汇区| 德州市| 安福县| 石城县| 隆回县| 罗定市| 红河县| 兴宁市| 长乐市| 塔河县|