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

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.

主站蜘蛛池模板: 额敏县| 洪雅县| 抚宁县| 雷波县| 竹溪县| 凤阳县| 酉阳| 日喀则市| 津市市| 淮北市| 武威市| 济南市| 皮山县| 周宁县| 西宁市| 馆陶县| 新昌县| 师宗县| 垫江县| 长岛县| 沙洋县| 宜良县| 云龙县| 广河县| 邯郸市| 灵武市| 科技| 奉新县| 余庆县| 英吉沙县| 塘沽区| 农安县| 汾阳市| 沾化县| 河南省| 高淳县| 清水县| 古蔺县| 通江县| 宁远县| 方城县|