{"id":589,"date":"2008-10-07T20:10:07","date_gmt":"2008-10-07T12:10:07","guid":{"rendered":"http:\/\/fdream.net\/blog\/article\/589.aspx"},"modified":"2008-10-07T20:10:46","modified_gmt":"2008-10-07T12:10:46","slug":"%5b%e7%bf%bb%e8%af%91%5djQuery%e5%92%8cMooTools%e7%9a%84%e7%9c%9f%e6%ad%a3%e5%8c%ba%e5%88%ab%ef%bc%88%e4%b8%8b%ef%bc%89","status":"publish","type":"post","link":"https:\/\/fdream.net\/blog\/article\/589","title":{"rendered":"[\u7ffb\u8bd1]jQuery\u548cMooTools\u7684\u771f\u6b63\u533a\u522b\uff08\u4e0b\uff09"},"content":{"rendered":"<p>\u770b\u8fd9\u7bc7\u4e4b\u524d\uff0c\u8bf7\u5148\u770b\u4e0a\u4e00\u7bc7\uff1a<a href=\"http:\/\/fdream.net\/blog\/article\/588.aspx\" target=\"_blank\" title=\"[\u7ffb\u8bd1]jQuery\u548cMooTools\u7684\u771f\u6b63\u533a\u522b\uff08\u4e0a\uff09\">[\u7ffb\u8bd1]jQuery\u548cMooTools\u7684\u771f\u6b63\u533a\u522b\uff08\u4e0a\uff09<\/a><\/p>\n<p><b>Extensibility &#8211; Because I Like To Tweak Things<\/b><\/p>\n<p><b>\u53ef\u6269\u5c55\u6027\u2014\u2014\u56e0\u4e3a\u6211\u559c\u6b22\u8c03\u6574\u4e00\u4e9b\u4e1c\u897f<\/b><\/p>\n<p>This brings me to the last big benefit that coding this way provides, assuming that you are writing your code in a way that lets you take advantage of it: extensibility. MooTools has a class based hierarchy (inspired by Dean Edwards excellent work), but don\u2019t let the name fool you. It\u2019s called a class but it\u2019s really just an object factory that makes taking advantage of the prototypal inheritance model in JavaScript easier.<\/p>\n<p>\u8fd9\u662f\u8fd9\u79cd\u7f16\u7801\u65b9\u5f0f\u7ed9\u6211\u4ee3\u7406\u7684\u6700\u540e\u4e00\u4e2a\u5927\u597d\u5904\uff0c\u5047\u8bbe\u4f60\u73b0\u5728\u5199\u4ee3\u7801\u7684\u65b9\u5f0f\u80fd\u591f\u5229\u7528\u5b83\u7684\u53ef\u6269\u5c55\u6027\u3002MooTools\u6709\u4e00\u79cd\u57fa\u4e8e\u7c7b\u7684\u5c42\u6b21\u7ed3\u6784\uff08\u7075\u611f\u6765\u6e90\u4e8eDean Edwards\u7684\u6770\u51fa\u5de5\u4f5c\uff09\uff0c\u4e0d\u8981\u88ab\u8fd9\u4e2a\u540d\u5b57\u7ed9\u6b3a\u9a97\u4e86\u3002\u5c3d\u7ba1\u5b83\u53eb\u505a\u7c7b\uff0c\u5b9e\u9645\u4e0a\u5c31\u53ea\u662f\u4e00\u4e2aobject\u5de5\u5382\uff0c\u53ea\u4e0d\u8fc7\u8ba9JavaScript\u91cc\u9762\u7684\u539f\u578b\u7ee7\u627f\u6a21\u578b\u53d8\u5f97\u66f4\u5bb9\u6613\u8ddf\u7b80\u5355\u800c\u5df2\u3002<\/p>\n<p>You don\u2019t need MooTools to do this of course. JavaScript will let you do it yourself. But because this is the way MooTools works from the ground up, it makes it hard to avoid writing your own code this way. Writing your own classes is really easy, and extending a class &#8211; even if you didn\u2019t write it &#8211; is easy, too.<\/p>\n<p>\u4f60\u5f53\u7136\u4e0d\u9700\u8981MooTools\u6765\u505a\u8fd9\u4e9b\u3002JavaScript\u53ef\u4ee5\u8ba9\u4f60\u81ea\u5df1\u6765\u5b9e\u73b0\u3002\u4f46\u662f\u7531\u4e8eMooTools\u5e95\u5c42\u5c31\u662f\u8fd9\u6837\u505a\u7684\uff0c\u56e0\u6b64\u5f88\u96be\u907f\u514d\u8ba9\u4f60\u53bb\u5199\u8fd9\u6837\u7684\u4ee3\u7801\u3002\u5199\u4e00\u4e2a\u4f60\u81ea\u5df1\u7684\u7c7b\u771f\u7684\u5f88\u5bb9\u6613\uff0c\u6269\u5c55\u4e00\u4e2a\u7c7b\u4e5f\u5f88\u5bb9\u6613\u2014\u2014\u5373\u4f7f\u4f60\u6ca1\u6709\u5199\u8fc7\u8fd9\u4e2a\u7c7b\u3002<\/p>\n<p>Let\u2019s take our FormPopup above. let\u2019s say we want to have the popup appear with an effect. Just to make it interesting, lets say that there is already code out there using it, so we don\u2019t want to alter it, but for the page we\u2019re on, we want the popup to fade in and fade out rather than just appear.<\/p>\n<p>\u7ee7\u7eed\u4ee5\u6211\u4eec\u4e0a\u9762\u63d0\u5230\u7684\u5f39\u51fa\u8868\u5355\u4e3a\u4f8b\u3002\u6211\u4eec\u8bf4\u6211\u4eec\u9700\u8981\u4e00\u4e2a\u5f39\u51fa\u663e\u793a\u6548\u679c\u3002\u4e3a\u4e86\u8ba9\u5176\u53d8\u5f97\u6709\u8da3\u4e00\u70b9\uff0c\u6211\u4eec\u5047\u8bbe\u5df2\u7ecf\u6709\u8fd9\u6837\u7684\u4ee3\u7801\u4e86\uff0c\u56e0\u6b64\u6211\u4eec\u4e0d\u60f3\u53bb\u6539\u53d8\u5b83\uff0c\u4f46\u662f\u5728\u8fd9\u4e2a\u9875\u9762\u4e2d\uff0c\u6211\u4eec\u60f3\u8981\u8fd9\u4e2a\u5f39\u51fa\u5c42\u6709\u6de1\u5165\u6de1\u51fa\u7684\u6548\u679c\uff0c\u800c\u4e0d\u4ec5\u4ec5\u662f\u51fa\u73b0\u3002<\/p>\n<p>MooTools lets you take any class (even the ones you didn\u2019t write) and extend them into new classes. You don\u2019t need to duplicate the whole class to add your differences &#8211; you only write the part you want to add or change.<\/p>\n<p>MooTools\u5141\u8bb8\u4f60\u4f7f\u7528\u4efb\u4f55\u7c7b\uff08\u751a\u81f3\u4f60\u6ca1\u6709\u5199\u8fc7\u7684\u7c7b\uff09\u5e76\u6269\u5c55\u6210\u4e3a\u4e00\u4e2a\u65b0\u7c7b\u3002\u4f60\u4e0d\u9700\u8981\u590d\u5236\u6574\u4e2a\u7c7b\u4ee5\u4fbf\u6dfb\u52a0\u4f60\u7684\u4e0d\u540c\u4ee3\u7801\u2014\u2014\u4f60\u53ea\u9700\u8981\u5199\u90a3\u4e9b\u4f60\u9700\u8981\u6dfb\u52a0\u6216\u8005\u6539\u53d8\u7684\u90e8\u5206\u5c31\u884c\u4e86\u3002<\/p>\n<p><pre lang=\"all\">\nvar PopupForm.Fx = new Class({\n    Extends: PopupForm,\n    show: function(){\n        this.popup.setStyles({\n            opacity: 0,\n            display: 'none'\n        }).tween('opacity', 1);\n    },\n    hide: function(){\n        this.popup.tween('opacity', 0).chain(function(){\n            this.popup.hide();\n        }.bind(this));\n    }\n});\n<\/pre>\n<\/p>\n<p>Now we have a new class called PopupForm.Fx that will fade the popup in and out. We haven\u2019t changed PopupForm at all. What\u2019s more, if we later find a bug in one of PopupForm\u2019s methods, we can fix it in that one place and it\u2019s fixed for both classes AND all the places we use it.<\/p>\n<p>\u73b0\u5728\uff0c\u6211\u4eec\u6709\u4e00\u4e2a\u540d\u5b57\u53eb\u505a\u201cPopupForm.Fx\u201d\u7684\u65b0\u7c7b\u4e86\uff0c\u8fd9\u4e2a\u7c7b\u53ef\u4ee5\u8ba9\u5f39\u51fa\u5c42\u6de1\u5165\u6de1\u51fa\u3002\u6211\u4eec\u5b8c\u5168\u6ca1\u6709\u6539\u53d8PopupForm\u7c7b\u3002\u53e6\u5916\uff0c\u5373\u4f7f\u6211\u4eec\u5728\u540e\u9762\u53d1\u73b0\u4e86PopupForm\u7c7b\u7684\u67d0\u4e2a\u65b9\u6cd5\u4e2d\u6709\u4e00\u4e2abug\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u90a3\u4e2a\u5730\u65b9\u4fee\u6b63\u5b83\uff0c\u8fd9\u5c06\u4f1a\u4fee\u590d\u8fd9\u4e24\u4e2a\u7c7b\u4ee5\u53ca\u6240\u6709\u6211\u4eec\u4f7f\u7528\u4e86\u5b83\u7684\u5730\u65b9\u3002<\/p>\n<p>When I write my code this way, it means that every page, site, and project I work on I add a few more tools to my toolbox when I go to the next project. I\u2019ve released over 70 plugins for MooTools in the last year or two, and this is just the code that I thought other people could use. Form validators, date pickers, and more. I\u2019ve written many more extensions for my own projects that aren\u2019t so generic, but they are no less reusable for my own work.<\/p>\n<p>\u5f53\u6211\u7528\u8fd9\u4e2a\u65b9\u5f0f\u5199\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u8fd9\u610f\u5473\u7740\u6211\u5728\u6211\u5de5\u4f5c\u7684\u6bcf\u4e00\u4e2a\u9875\u9762\u3001\u7f51\u7ad9\u548c\u9879\u76ee\u4e2d\u90fd\u6dfb\u52a0\u4e86\u4e00\u4e9b\u65b0\u7684\u5de5\u5177\u5230\u6211\u7684\u5de5\u5177\u7bb1\uff0c\u5f53\u5230\u4e0b\u4e00\u4e2a\u9879\u76ee\u65f6\u6211\u4ecd\u7136\u53ef\u4ee5\u4f7f\u7528\u3002\u5728\u8fc7\u53bb\u7684\u4e00\u4e24\u5e74\u91cc\uff0c\u6211\u5df2\u7ecf\u4e3aMooTools\u53d1\u5e03\u4e86\u8d85\u8fc770\u4e2a\u63d2\u4ef6\uff0c\u800c\u8fd9\u8fd8\u53ea\u662f\u6211\u8ba4\u4e3a\u5176\u4ed6\u4eba\u80fd\u591f\u7528\u5230\u7684\u4e1c\u897f\u3002\u8868\u5355\u9a8c\u8bc1\u3001\u6570\u636e\u63d0\u53d6\u4ee5\u53ca\u5176\u4ed6\u3002\u6211\u8fd8\u4e3a\u6211\u81ea\u5df1\u7684\u9879\u76ee\u5199\u4e86\u5f88\u591a\u6269\u5c55\uff0c\u5c3d\u7ba1\u5b83\u4eec\u4e0d\u662f\u5f88\u901a\u7528\uff0c\u4f46\u662f\u5728\u6211\u7684\u52a8\u4f5c\u4e2d\u5e76\u6ca1\u6709\u5c11\u91cd\u7528\u5b83\u4eec\u3002<\/p>\n<p><b>Looking Under the Hood<\/b><\/p>\n<p><b>\u63ed\u5f00\u9762\u7eb1\u770b\u770b<\/b><\/p>\n<p>All this brings me back to what I really wanted to talk about, which is my thinking about MooTools and what makes it different from many other frameworks. Watching the jQuery presentations (again, jQuery is just different &#8211; not better or worse), I realized that MooTools and jQuery are very different in the solutions they present.<\/p>\n<p>\u6240\u6709\u7684\u8fd9\u4e00\u5207\u8ba9\u6211\u56de\u5230\u4e86\u6211\u771f\u6b63\u8981\u8bf4\u7684\uff1a\u6211\u662f\u600e\u6837\u770b\u5f85MooTools\u4ee5\u53ca\u5b83\u4e0e\u5176\u4ed6\u6846\u67b6\u6709\u4ec0\u4e48\u4e0d\u4e00\u6837\u3002\u770b\u770bjQuery\u7684\u8868\u73b0\uff08\u518d\u6b21\u91cd\u590d\uff1ajQuery\u4ec5\u4ec5\u53ea\u662f\u4e0d\u540c\u2014\u2014\u6ca1\u6709\u4f18\u52a3\u4e4b\u5206\uff09\uff0c\u6211\u8ba4\u4e3aMooTools\u548cjQuery\u6700\u5927\u7684\u4e0d\u540c\u5728\u8868\u73b0\u7684\u89e3\u51b3\u65b9\u6848\u4e0a\u3002<\/p>\n<p>When talking with Bill Scott about his team and their use of jQuery, I asked him about what they do to program to patterns. Bill\u2019s a great guy to ask about this because he spent a lot of last year giving a great talk about user experience patterns and YUI (I highly recommend it). He lead the project for the whole YUI pattern library. Here\u2019s a guy who is all about creating patterns for reusability. I asked him about working with jQuery, which has mechanisms for creating plugins, but not a way to extend those plugins and, frankly, the plugin mechanism seems a little awkward to me (for instance, if you want to call a plugin method, you must do jQuery(domId).pluginName(\u201dmethodName\u201d, [arg1, arg2]); &#8211; I hope I have that right &#8211; this seems incredibly esoteric to me).<\/p>\n<p>\u5f53\u548cBill Scott\u8c08\u8bba\u4ed6\u7684\u56e2\u961f\u548c\u4ed6\u4eec\u5bf9jQuery\u7684\u4f7f\u7528\uff0c\u6211\u8be2\u95ee\u4e86\u4ed6\u4eec\u5bf9\u4e8e\u6309\u6a21\u5f0f\u7f16\u7a0b\u7684\u6240\u505a\u7684\u5de5\u4f5c\u3002Bill\u662f\u76f8\u5f53\u9002\u5408\u95ee\u8fd9\u4e2a\u95ee\u9898\u7684\u4eba\u9009\uff0c\u56e0\u4e3a\u4ed6\u53bb\u5e74\u82b1\u4e86\u5f88\u957f\u65f6\u95f4\u505a\u4e86\u4e00\u4e2a\u5173\u4e8e\u7528\u6237\u4f53\u9a8c\u6a21\u5f0f\u548cYUI\u7684\u6f14\u8bb2\uff08\u6211\u5f3a\u70c8\u63a8\u8350\u8fd9\u4e2a\uff09\u3002\u4ed6\u9886\u5bfc\u4e86\u6574\u4e2aYUI\u9879\u76ee\u6a21\u5f0f\u5e93\u3002\u4ed6\u662f\u4e00\u4e2a\u4e00\u76f4\u81f4\u529b\u4e8e\u4e3a\u91cd\u7528\u800c\u521b\u5efa\u6a21\u5f0f\u7684\u4eba\u3002\u6211\u95ee\u4e86\u4ed6\u5173\u4e8e\u5728jQuery\u4e2d\u521b\u5efa\u63d2\u4ef6\u7684\u673a\u5236\uff0c\u800c\u4e0d\u662f\u6269\u5c55\u90a3\u4e9b\u63d2\u4ef6\uff0c\u5766\u7387\u5730\u8bf4\uff0c\u8fd9\u4e2a\u63d2\u4ef6\u673a\u5236\u5bf9\u4e8e\u6211\u6765\u8bf4\u6709\u4e00\u70b9\u5c34\u5c2c\uff08\u4f8b\u5982\uff0c\u4f60\u4e3a\u4e86\u8c03\u7528\u4e00\u4e2a\u63d2\u4ef6\u7684\u65b9\u6cd5\uff0c\u4f60\u5fc5\u987b\u8fd9\u6837\u5199\uff1ajQuery(domId).pluginName(\u201dmethodName\u201d, [arg1, arg2]);\u2014\u2014\u6211\u5e0c\u671b\u6211\u8bf4\u7684\u662f\u5bf9\u7684\u2014\u2014\u8fd9\u5bf9\u4e8e\u6211\u6765\u8bf4\u5b9e\u5728\u662f\u795e\u79d8\u83ab\u6d4b\uff09<\/p>\n<p>After hearing me talk about the reusability and extensibility patterns built into MooTools, he made an excellent point: He knows enough about JavaScript to have his own methods for making use of JavaScript\u2019s inheritance mechanisms. In other words, he uses jQuery for DOM manipulation and effects and for some of its plugins, but when he writes his own code, he has his own class system (I don\u2019t think he used the word \u201cclass\u201d though &#8211; but basically some sort of factory to create reusable and extendable objects).<\/p>\n<p>\u5728\u542c\u6211\u8c08\u5b8c\u5173\u4e8eMooTools\u91cc\u9762\u7684\u53ef\u91cd\u7528\u6027\u548c\u53ef\u6269\u5c55\u6027\u6a21\u5f0f\u4e4b\u540e\uff0c\u4ed6\u505a\u4e86\u4e00\u4e2a\u5f88\u7cbe\u5999\u7684\u603b\u7ed3\uff1a\u4ed6\u5bf9JavaScript\u975e\u5e38\u4e86\u89e3\uff0c\u53ef\u4ee5\u5229\u7528JavaScript\u672c\u8eab\u5185\u7f6e\u7684\u4e00\u4e9b\u673a\u5236\u6765\u5b8c\u6210\u4ed6\u81ea\u5df1\u7684\u4e00\u4e9b\u65b9\u6cd5\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u4ed6\u7528jQuery\u8fdb\u884cDom\u64cd\u4f5c\u3001\u5b9e\u73b0\u7279\u6548\u4ee5\u53ca\u7528\u4e8e\u4e00\u4e9b\u5176\u4ed6\u63d2\u4ef6\uff0c\u4f46\u662f\u5f53\u4ed6\u5199\u81ea\u5df1\u7684\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u4ed6\u6709\u4e86\u81ea\u5df1\u7684\u7c7b\u7cfb\u7edf\uff08\u5c3d\u7ba1\u6211\u4e0d\u786e\u5b9a\u4ed6\u7528\u4e86\u201c\u7c7b\u201d\u8fd9\u4e2a\u8bcd\u2014\u2014\u4f46\u662f\u672c\u8d28\u4e0a\u6709\u4e00\u4e9b\u5de5\u5382\u53bb\u521b\u5efa\u8fd9\u4e9b\u53ef\u91cd\u7528\u548c\u53ef\u6269\u5c55\u7684object\uff09\u3002<\/p>\n<p><b>JavaScript Has Its Own Methods For Reuse<\/b><\/p>\n<p><b>JavaScript\u6709\u5b83\u81ea\u5df1\u7684\u91cd\u7528\u65b9\u6cd5<\/b><\/p>\n<p>This, frankly, was something I hadn\u2019t considered. jQuery is really, really good at obscuring the DOM and its headaches from the user. It\u2019s simple to use and very expressive. Viewed as a part of a broader framework (i.e one in which the user is just making use of JavaScript\u2019s inherent potential as an object oriented language) it makes a lot of sense.<\/p>\n<p>\u8fd9\u4e2a\uff0c\u5766\u7387\u5730\u8bb2\uff0c\u662f\u6211\u6ca1\u6709\u8003\u8651\u5230\u7684\u3002jQuery\u5728\u6a21\u7ccaDOM\u65b9\u9762\u505a\u5f97\u975e\u5e38\u975e\u5e38\u7684\u597d\uff0c\u4f7f\u5f97\u7528\u6237\u4e0d\u518d\u90a3\u4e48\u5934\u75bc\u3002\u5b83\u4f7f\u7528\u8d77\u6765\u975e\u5e38\u7b80\u5355\u800c\u4e14\u975e\u5e38\u5584\u4e8e\u8868\u73b0\u3002\u4f5c\u4e3a\u4e00\u4e2a\u5bbd\u6cdb\u7684\u6846\u67b6\uff08\u5373\u5728\u8fd9\u4e2a\u6846\u67b6\u4e2d\uff0c\u7528\u6237\u53ea\u662f\u628aJavaScript\u5f53\u4f5c\u4e00\u79cd\u9762\u5411\u5bf9\u8c61\u8bed\u8a00\uff09\u7684\u4e00\u90e8\u5206\u6765\u770b\uff0c\u5b83\u662f\u5f88\u660e\u667a\u7684\u3002<\/p>\n<p>But then Bill said something else that made me seriously consider the participants in all the talks at the Ajax Experience. He said something to the effect: \u201cBut I guess I just never really thought that other people wouldn\u2019t do that.\u201d That other people would use jQuery (or any other Framework, or even just vanilla JavaScript) and NOT make use of JavaScript\u2019s (somewhat hidden) inheritance system.<\/p>\n<p>\u4f46\u662fBill\u968f\u540e\u8bf4\u7684\u8bdd\u8ba9\u6211\u8ba4\u771f\u5730\u601d\u8003\u4e86\u5728Ajax\u4f53\u9a8c\u8fc7\u7a0b\u4e2d\u7684\u53c2\u4e0e\u8005\u3002\u4ed6\u662f\u8fd9\u6837\u8bf4\u7684\uff1a\u201c\u6211\u4ece\u6765\u6ca1\u6709\u8ba4\u771f\u5730\u8ba4\u4e3a\u5176\u4ed6\u4eba\u4e0d\u4f1a\u8fd9\u4e48\u505a\u3002\u201d\u5176\u4ed6\u4eba\u53ef\u4ee5\u4f7f\u7528jQuery\uff08\u6216\u8005\u5176\u4ed6\u4efb\u4f55\u6846\u67b6\uff0c\u751a\u81f3\u53ea\u662f\u201c\u9999\u8349\u5473\u201d\u7684JavaScript\uff09\u800c\u4e0d\u5229\u7528JavaScript\u7684\u4efb\u4f55\u672c\u8eab\u7279\u6027\uff08\u5305\u62ec\u9690\u85cf\u7684\u7279\u6027\uff09\u3002<\/p>\n<p>This is when three things clicked for me. Three really big things that, to me, only reinforce my preference for MooTools.<\/p>\n<p>\u8fd9\u91cc\u662f\u4e09\u4ef6\u771f\u6b63\u89e6\u52a8\u6211\u7684\u4e8b\u60c5\u3002\u8fd9\u4e09\u4ef6\u771f\u6b63\u7684\u5927\u4e8b\uff0c\u5bf9\u6211\u800c\u8a00\uff0c\u53ea\u4f1a\u8ba9\u6211\u66f4\u52a0\u504f\u597dMooTools\u3002<\/p>\n<p><b>Everyone Is a Noob At Something<\/b><\/p>\n<p><b>\u6bcf\u4e2a\u4eba\u5728\u67d0\u4e9b\u4e8b\u60c5\u4e0a\u90fd\u662f\u4e00\u53ea\u83dc\u9e1f<\/b><\/p>\n<p>The first big thing was that a lot of people (maybe not all, or a majority, or even a third &#8211; who knows) using the frameworks don\u2019t think think this way. MooTools users, jQuery users, YUI users. They just write the code to get the page to do what they want (and to be clear, I wrote a lot of my code this way until earlier this year &#8211; now almost everything I write are classes). These people are excited about what they are able to do in the browser and they are excited with how fun\/powerful\/slick\/usable\/whatever their sites are. When they need to refactor them, it will be painful, but they are happy non-the-less (again, I am\/was one of these people &#8211; I\u2019m not talking down).<\/p>\n<p>\u7b2c\u4e00\u4ef6\u5927\u4e8b\u5c31\u662f\uff1a\u4f7f\u7528\u6846\u67b6\u7684\u8bb8\u591a\u4eba\uff08\u53ef\u80fd\u4e0d\u662f\u5168\u90e8\u3001\u6216\u8005\u7edd\u5927\u591a\u6570\u751a\u81f3\u53ea\u6709\u4e09\u5206\u4e4b\u4e00\u2014\u2014\u8c01\u77e5\u9053\u5462\uff09\u90fd\u4e0d\u8fd9\u6837\u8ba4\u4e3a\u3002MooTools\u7684\u7528\u6237\uff0cjQuery\u7684\u7528\u6237\uff0cYUI\u7684\u7528\u6237\uff0c\u4ed6\u4eec\u53ea\u662f\u53bb\u5199\u4ee3\u7801\u8ba9\u9875\u9762\u53bb\u505a\u4ed6\u4eec\u60f3\u505a\u7684\u4e8b\u60c5\uff08\u8981\u8bf4\u6e05\u695a\u7684\u662f\uff1a\u76f4\u5230\u4eca\u5e74\u5e74\u521d\uff0c\u6211\u7528\u8fd9\u79cd\u65b9\u5f0f\u5199\u4e86\u8bb8\u591a\u4ee3\u7801\u2014\u2014\u4f46\u662f\u73b0\u5728\u6211\u5199\u7684\u6bcf\u4e2a\u4e1c\u897f\u6551\u62a4\u90fd\u662f\u4e00\u4e2a\u7c7b\uff09\u3002\u8fd9\u4e9b\u4eba\u4e3a\u4ed6\u4eec\u80fd\u5728\u6d4f\u89c8\u5668\u91cc\u505a\u7684\u90a3\u4e9b\u4e8b\u60c5\u611f\u5230\u6fc0\u52a8\uff0c\u4e3a\u4ed6\u4eec\u7684\u7f51\u7ad9\u6709\u591a\u4e48\u6709\u8da3\u3001\u5f3a\u5927\u3001\u6d41\u7545\u3001\u53ef\u7528\u7b49\u7b49\u4efb\u4f55\u4e8b\u60c5\u800c\u6fc0\u52a8\u3002\u5f53\u4ed6\u4eec\u9700\u8981\u91cd\u6784\u7684\u65f6\u5019\uff0c\u8fd9\u5c06\u4f1a\u975e\u5e38\u7684\u75db\u82e6\uff0c\u4e0d\u8fc7\u4ed6\u4eec\u8fd8\u662f\u5f88\u9ad8\u5174\u2014\u2014\u81f3\u5c11\u6bd4\u6ca1\u6709\u4e1c\u897f\u597d\uff08\u518d\u8bf4\u4e00\u904d\uff1a\u6211\u4e5f\u662f\u8fd9\u4e9b\u4eba\u4e2d\u7684\u4e00\u4e2a\u2014\u2014\u6211\u6ca1\u6709\u770b\u4e0d\u8d77\u4ed6\u4eec\u7684\u610f\u601d\uff09\u3002<\/p>\n<p>I think it\u2019s safe to say that of all the frameworks, jQuery makes this experience easy to get into. It so completely obscures the browser and feels so much like CSS in many ways that it\u2019s like a gateway drug. You do a little, and then you can\u2019t stop. If jQuery has accomplished nothing else, it has introduced a lot of people to JavaScript and got them to stick around. This is no minor accomplishment.<\/p>\n<p>\u6211\u8ba4\u4e3a\u73b0\u5728\u53ef\u4ee5\u5b89\u5168\u5730\u8bf4\uff0c\u5728\u90a3\u4e9b\u6846\u67b6\u4e2d\uff0cjQuery\u8ba9\u8fd9\u4e2d\u4f53\u9a8c\u53d8\u5f97\u975e\u5e38\u5bb9\u6613\u5207\u5165\u3002\u5b83\u662f\u5982\u6b64\u5b8c\u6574\u5730\u6a21\u7cca\u4e86\u6d4f\u89c8\u5668\uff0c\u800c\u5728\u5f88\u591a\u65b9\u9762\u53c8\u662f\u5982\u6b64\u5730\u50cfCSS\uff0c\u5c31\u50cf\u4e00\u5242\u5165\u95e8\u6bd2\u836f\u3002\u4f60\u505a\u4e86\u4e00\u70b9\u70b9\uff0c\u7136\u540e\u4f60\u5c31\u518d\u4e5f\u4e0d\u80fd\u505c\u6b62\u3002\u5982\u679cjQuery\u6ca1\u6709\u5b8c\u6210\u5176\u4ed6\u4efb\u4f55\u4e1c\u897f\uff0c\u53ea\u662f\u628aJavaScript\u4ecb\u7ecd\u7ed9\u90a3\u4e9b\u4eba\u7136\u540e\u8ba9\u4ed6\u4eec\u575a\u6301\u4f7f\u7528\uff0c\u8fd9\u5c31\u662f\u4e2a\u4e0d\u5c0f\u7684\u6210\u5c31\u3002<\/p>\n<p><b>But We All Learn Eventually<\/b><\/p>\n<p><b>\u4f46\u662f\u6211\u4eec\u6700\u7ec8\u8fd8\u662f\u8981\u5b66\u4e60<\/b><\/p>\n<p>The second big thing that became apparent to me was that sooner or later, people writing this way are going to get really, really good at it, and when they do, they\u2019ll want to be more efficient. They may not take the same road as I\u2019m currently on &#8211; the number of frameworks out there illustrate that there are a lot of ways to skin this cat. But they will get past the \u201chey look, I can make a slick ajax login box\u201d phase and will want to start developing code that\u2019s easier to reuse, maintain, and extend. That\u2019s when they\u2019ll re-read Crockford\u2019s book and ask themselves why they aren\u2019t doing some of the stuff in there.<\/p>\n<p>\u7b2c\u4e8c\u4ef6\u5927\u4e8b\u5bf9\u6211\u6765\u8bf4\u53d8\u5f97\u5f88\u660e\u663e\uff0c\u65e0\u8bba\u8fdf\u65e9\uff0c\u4eba\u4eec\u8d8a\u6765\u8d8a\u719f\u7ec3\u5730\u7528\u8fd9\u79cd\u65b9\u5f0f\u5199\u4ee3\u7801\uff0c\u5f53\u4ed6\u4eec\u5199\u7684\u65f6\u5019\uff0c\u4ed6\u4eec\u4f1a\u60f3\u53d8\u5f97\u66f4\u6709\u6548\u7387\u3002\u4ed6\u4eec\u53ef\u80fd\u4e0d\u4f1a\u9009\u62e9\u8ddf\u6211\u73b0\u5728\u4e00\u6837\u7684\u9053\u8def\u2014\u2014\u90a3\u4e9b\u6846\u67b6\u7684\u6570\u76ee\u5df2\u7ecf\u8bf4\u660e\u90a3\u91cc\u6709\u5f88\u591a\u65b9\u5f0f\u53bb\u7ed9\u8fd9\u53ea\u732b\u4e0a\u8272\u3002\u4f46\u662f\u4ed6\u4eec\u5c06\u4f1a\u5ea6\u8fc7\u8fd9\u6837\u4e00\u4e2a\u9636\u6bb5\uff1a\u201c\u55e8\uff0c\u4f60\u770b\uff0c\u6211\u80fd\u505a\u4e00\u4e2a\u6d41\u7545\u7684Ajax\u767b\u9646\u6846\u4e86\uff01\u201d\u7136\u540e\u4ed6\u4eec\u4f1a\u60f3\u7740\u53bb\u5f00\u59cb\u5f00\u53d1\u4e00\u4e9b\u66f4\u52a0\u5bb9\u6613\u91cd\u7528\u3001\u5bb9\u6613\u7ef4\u62a4\u548c\u5bb9\u6613\u6269\u5c55\u7684\u4ee3\u7801\u3002\u5728\u90a3\u4e2a\u65f6\u5019\uff0c\u4ed6\u4eec\u5c06\u4f1a\u91cd\u65b0\u9605\u8bfb\u201cCrockford\u7684\u4e66\u201d\uff0c\u7136\u540e\u53cd\u95ee\u81ea\u5df1\u4e3a\u4ec0\u4e48\u4ed6\u4eec\u4e0d\u5728\u90a3\u91cc\u505a\u4e00\u4e9b\u5de5\u4f5c\u5462\uff1f<\/p>\n<p>Again, regardless of which framework they are using, this is going to happen. Step one: learn javascript syntax basics. Step two: learn to do some fun effects\/ajax with a framework. Step four through seven hundred and nineteen: make a bunch of stupid mistakes and learn some stuff the hard way. Step seven hundred and twenty: get really good at JavaScript and look back on your previous work with disdain. This is the way of all programming experience, am I right people? (Hey, afford me one generalizing, sweeping statement about all programming languages, ok?)<\/p>\n<p>\u518d\u8bf4\u4e00\u904d\uff0c\u4e0d\u7ba1\u4f60\u5728\u7528\u4ec0\u4e48\u6846\u67b6\uff0c\u8fd9\u90fd\u4f1a\u53d1\u751f\u3002\u7b2c1\u6b65\uff1a\u5b66\u4e60JavaScript\u57fa\u672c\u8bed\u6cd5\u3002\u7b2c2\u6b65\uff1a\u5b66\u4e60\u5229\u7528\u6846\u67b6\u505a\u4e00\u4e9b\u6709\u8da3\u7684\u6548\u679c\u6216\u8005ajax\u5e94\u7528\u3002\u7b2c4\u6b65\uff08\u8bd1\u8005\u6ce8\uff1a\u8c8c\u4f3c\u662f\u7b2c3\u6b65\uff0c\u4e0d\u8fc7\u4e0d\u5fc5\u8f83\u771f\uff09\u5230719\u6b65\uff1a\u72af\u4e00\u5927\u5806\u5f88\u611a\u8822\u7684\u9519\u8bef\u5e76\u5b66\u4e60\u4e00\u4e9b\u4e1c\u897f\u3002\u7b2c720\u6b65\uff1a\u771f\u6b63\u638c\u63e1JavaScript\u7136\u540e\u5f88\u8511\u89c6\u5730\u56de\u5934\u770b\u770b\u4f60\u4ee5\u524d\u7684\u5de5\u4f5c\u3002\u8fd9\u662f\u6240\u6709\u7684\u7f16\u7a0b\u7ecf\u9a8c\uff0c\u6211\u662f\u5bf9\u7684\u5417\uff1f\uff08\u563f\uff0c\u611f\u8c22\u6211\u7528\u4e00\u53e5\u901a\u7528\u7684\u5168\u9762\u7684\u8bdd\u6982\u62ec\u4e86\u6240\u6709\u7684\u7f16\u7a0b\u8bed\u8a00\u5427\uff01\uff09<\/p>\n<p><b>With Frameworks, What Matters Is Hidden Deep Inside<\/b><\/p>\n<p><b>\u5728\u6846\u67b6\u4e2d\uff0c\u8981\u7d27\u7684\u662f\u5b83\u91cc\u9762\u7684\u4e1c\u897f<\/b><\/p>\n<p>And this, finally, led me to the third big thing. The thing that reaffirms my choice of MooTools. All the frameworks out there are increasingly becoming very similar to each other at the edges. I.E. they all eventually look something like this:<\/p>\n<p>\u8fd9\u4e2a\uff0c\u6700\u7ec8\uff0c\u628a\u6211\u5e26\u5411\u4e86\u7b2c\u4e09\u4ef6\u5927\u4e8b\u3002\u8fd9\u4e2a\u4e8b\u4ef6\u8ba9\u6211\u786e\u5b9a\u4e86\u6211\u5bf9MooTools\u7684\u9009\u62e9\u3002\u6240\u6709\u7684\u6846\u67b6\u90fd\u53d8\u5f97\u65e5\u76ca\u76f8\u4f3c\u3002\u5373\u6709\u4e00\u5929\u4ed6\u4eec\u6700\u7ec8\u4f1a\u770b\u8d77\u6765\u50cf\u8fd9\u4e9b\u4e1c\u897f\uff1a<\/p>\n<p><pre lang=\"all\">\nfetch(element).verb(details).verb(details).verb(details)\n<\/pre>\n<\/p>\n<p>The only real difference is terminology. One framework might use $, another might do something like, oh, Y.get, or jQuery(id), followed by different verbs that are synonymous with the next framework. At the edges, they all do the same thing. This is because we all see good patterns in each others\u2019 work and incorporate it &#8211; again, we\u2019re all working against the same thing &#8211; the browsers &#8211; for the same purpose.<\/p>\n<p>\u552f\u4e00\u7684\u771f\u6b63\u533a\u522b\u53ea\u662f\u4ed6\u4eec\u7684\u672f\u8bed\u4e0d\u4e00\u6837\u3002\u4e00\u4e2a\u6846\u67b6\u53ef\u80fd\u4f7f\u7528$\uff0c\u53e6\u5916\u4e00\u4e2a\u53ef\u80fd\u505a\u540c\u6837\u7684\u4e8b\u60c5\uff0c\u4f8b\u5982Y.get\u6216\u8005jQuery(id)\uff0c\u672a\u6765\u7684\u6846\u67b6\u53ea\u662f\u4f7f\u7528\u4e86\u540c\u610f\u7684\u4e0d\u7528\u8bcd\u6c47\u800c\u5df2\u3002\u5728\u8fb9\u7f18\uff0c\u4ed6\u4eec\u90fd\u505a\u540c\u6837\u7684\u4e8b\u60c5\u3002\u8fd9\u662f\u56e0\u4e3a\u6211\u4eec\u90fd\u5f7c\u6b64\u770b\u5230\u4e86\u5bf9\u65b9\u5de5\u4f5c\u4e2d\u597d\u7684\u6a21\u5f0f\u7136\u540e\u52a0\u4ee5\u5438\u6536\u2014\u2014\u518d\u91cd\u7533\u4e00\u904d\uff0c\u6211\u4eec\u5168\u90e8\u5728\u548c\u540c\u4e00\u4e2a\u4e1c\u897f\u505a\u6597\u4e89\u2014\u2014\u6d4f\u89c8\u5668\u2014\u2014\u4e3a\u4e86\u540c\u6837\u7684\u76ee\u7684\u3002<\/p>\n<p>But where they are different is deep down in the core. The developers of these frameworks don\u2019t spent their days writing code to animate login boxes. Sure, they write that stuff for their own projects, but the framework work itself is down inside. Sooner or later, anyone starting out learning one of these frameworks is going to get to a point where writing code at the edges are going to want to start making use of the mojo down in the core. They are going to re-read Crockford\u2019s book and think, \u201cI am going about this the hard way &#8211; I\u2019m repeating myself too much, and that thing I wrote today was almost, but not quite, identical to the thing I wrote yesterday. There has to be a better way.\u201d People like Bill Scott are already doing this, but everyone just getting started are still impressed by seeing something bounce on the screen (as well they should be).<\/p>\n<p>\u4f46\u662f\u5728\u6838\u5fc3\u6df1\u5904\uff0c\u4ed6\u4eec\u662f\u5404\u4e0d\u76f8\u540c\u7684\u3002\u8fd9\u4e9b\u6846\u67b6\u7684\u5f00\u53d1\u8005\u4e0d\u4f1a\u82b1\u5927\u91cf\u7684\u65f6\u95f4\u6765\u5199\u4e00\u4e2a\u8ba9\u767b\u9646\u6846\u53d8\u5316\u7684\u4ee3\u7801\u3002\u5f53\u7136\uff0c\u4ed6\u4eec\u4e3a\u5404\u81ea\u7684\u9879\u76ee\u5b8c\u6210\u8fd9\u6837\u7684\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u6846\u67b6\u672c\u8eab\u7684\u5de5\u4f5c\u5728\u5185\u90e8\u8fdb\u884c\u3002\u8fdf\u65e9\uff0c\u4efb\u4f55\u4eba\u5f00\u59cb\u5b66\u4e60\u5176\u4e2d\u7684\u4e00\u4e2a\u6846\u67b6\uff0c\u5c31\u4f1a\u63a5\u89e6\u5230\u8fb9\u7f18\u4ee3\u7801\uff0c\u7136\u540e\u5c31\u4f1a\u60f3\u53bb\u5229\u7528\u6838\u5fc3\u7684\u4ee3\u7801\u3002\u4ed6\u4eec\u4f1a\u91cd\u65b0\u9605\u8bfb\u201cCrockford\u7684\u4e66\u201d\u5e76\u60f3\uff1a\u201c\u6211\u5728\u7528\u5f88\u56f0\u96be\u7684\u65b9\u5f0f\u505a\u8fd9\u4e2a\u2014\u2014\u6211\u4e0d\u505c\u5730\u91cd\u590d\u592a\u591a\u4e86\uff0c\u90a3\u4e2a\u4e1c\u897f\u548c\u6211\u6628\u5929\u5199\u7684\u4e1c\u897f\u51e0\u4e4e\u4e00\u6837\uff0c\u867d\u7136\u4e0d\u5b8c\u5168\u4e00\u6837\u3002\u90a3\u91cc\u80af\u5b9a\u6709\u66f4\u597d\u7684\u65b9\u5f0f\u3002\u201d\u50cfBill Scott\u8fd9\u6837\u7684\u4eba\u5df2\u7ecf\u5728\u505a\u8fd9\u4e9b\u4e86\uff0c\u4f46\u662f\u6bcf\u4e2a\u521a\u521a\u5f00\u59cb\u7684\u4eba\u8fd8\u6df1\u6df1\u5730\u94ed\u8bb0\u7740\u4ece\u5c4f\u5e55\u4e0a\u770b\u5230\u7684\u90a3\u4e9b\u7eda\u4e3d\u7684\u4e1c\u897f\uff08\u5f53\u7136\uff0c\u4ed6\u4eec\u5e94\u8be5\u8fd9\u6837\uff09\u3002<\/p>\n<p>When they get really good and are ready to take that next step, they will look to the core of their library of choice for guidance. After spending months grinding out code with whatever framework they started with, they\u2019ll look to the experts of that framework for answers, and the experts are writing the core. Every framework has a mechanism for writing plugins and extending them and I will admit that I am only familiar with a few of them in a cursory manner. I cannot pass judgement on any of them save MooTools, so I\u2019ll limit my pronouncements to that. Nearly all of the functionality in MooTools is implemented as extensions to native objects (arrays, strings, etc) and classes. Throughout the library the principals of (shallow) inheritance and reuse are illustrated in an easy to read and easy to use manner. It is because of this that my own code has gotten so much better than it used to be (and I\u2019m a contributor! &#8211; don\u2019t hold that against the framework, please).<\/p>\n<p>\u5f53\u4ed6\u4eec\u771f\u7684\u591f\u597d\u5e76\u4e14\u5df2\u7ecf\u51c6\u5907\u597d\u53bb\u5b9e\u65bd\u4e0b\u4e00\u6b65\u7684\u65f6\u5019\uff0c\u4ed6\u4eec\u5c06\u4f1a\u770b\u770b\u4ed6\u4eec\u5e93\u7684\u5185\u6838\u6765\u8fdb\u884c\u9009\u62e9\u3002\u65e0\u8bba\u5f00\u59cb\u4f7f\u7528\u4ec0\u4e48\u6846\u67b6\uff0c\u5728\u51e0\u4e2a\u6708\u4e4b\u540e\uff0c\u4ed6\u4eec\u5199\u51fa\u4e86\u4ee3\u7801\uff0c\u4ed6\u4eec\u4f1a\u671f\u5f85\u90a3\u4e9b\u6846\u67b6\u4e13\u5bb6\u7684\u7b54\u6848\uff0c\u4e13\u5bb6\u4eec\u6b63\u5728\u5199\u5185\u6838\u3002\u6bcf\u4e2a\u6846\u67b6\u90fd\u6709\u5f00\u53d1\u63d2\u4ef6\u548c\u5bf9\u5176\u8fdb\u884c\u6269\u5c55\u7684\u673a\u5236\uff0c\u6211\u627f\u8ba4\u6211\u53ea\u662f\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u719f\u6089\u5176\u4e2d\u7684\u4e00\u90e8\u5206\u3002\u6211\u4e0d\u80fd\u5bf9\u4ed6\u4eec\u7ed9\u51fa\u4efb\u4f55\u8bc4\u4ef7\u9664\u4e86MooTools\uff0c\u56e0\u6b64\u6211\u5c06\u5bf9\u90a3\u4e9b\u4e1c\u897f\u7ea6\u675f\u6211\u7684\u8a00\u8bba\u3002\u51e0\u4e4e\u6240\u6709\u7684MooTools\u7684\u529f\u80fd\u6027\u7684\u4e1c\u897f\u90fd\u662f\u901a\u8fc7\u6269\u5c55\u672c\u5730\u5bf9\u8c61\uff08\u6570\u7ec4\u3001\u5b57\u7b26\u4e32\u7b49\uff09\u6216\u8005\u7c7b\u5b9e\u73b0\u7684\u3002\u8d2f\u7a7f\u6574\u4e2a\u5e93\u7684\u4e3b\u8981\uff08\u6d45\uff09\u7ee7\u627f\u548c\u91cd\u7528\u90fd\u901a\u8fc7\u6613\u8bfb\u548c\u6613\u7528\u7684\u65b9\u5f0f\u5f97\u5230\u4e86\u8bc1\u660e\u3002\u6b63\u662f\u56e0\u4e3a\u5982\u6b64\uff0c\u6211\u81ea\u5df1\u7684\u4ee3\u7801\u4e5f\u6bd4\u4ee5\u524d\u8981\u597d\u5f97\u591a\u4e86\uff08\u6211\u4e5f\u662f\u4e00\u4e2a\u8d21\u732e\u8005\uff01\u2014\u2014\u4e0d\u8981\u8001\u662f\u5bf9\u90a3\u4e9b\u6846\u67b6\u6709\u504f\u89c1\uff09\u3002<\/p>\n<p><b>Why MooTools Rocks (At Least, Why I Think It Does)<\/b><\/p>\n<p><b>\u4e3a\u4ec0\u4e48MooTools\u6709\u9707\u64bc\u529b\uff08\u81f3\u5c11\uff0c\u6211\u4e3a\u4ec0\u4e48\u8fd9\u4e48\u8ba4\u4e3a\uff09<\/b><\/p>\n<p>So now, when people ask me why I think MooTools is the better choice, I\u2019ll still tell them that it\u2019s not about what\u2019s better than the next one, and that all the frameworks are good choices, but the reason that I, personally, prefer MooTools is finally something I can put into words. All the frameworks achieve similar goals in different ways, but, for me at least, MooTools helps me solve my design and implementation challenges once, which is definitely good enough reason for me.<\/p>\n<p>\u73b0\u5728\uff0c\u5f53\u4eba\u4eec\u95ee\u6211\u4e3a\u4ec0\u4e48\u6211\u89c9\u5f97MooTools\u662f\u66f4\u597d\u7684\u9009\u62e9\uff0c\u6211\u4ecd\u7136\u4f1a\u544a\u8bc9\u4ed6\u4eec\uff1a\u4e0d\u662f\u4ec0\u4e48\u8fd9\u4e2a\u6846\u67b6\u597d\u4e8e\u5176\u5b83\u6846\u67b6\uff0c\u6240\u6709\u7684\u6846\u67b6\u90fd\u662f\u597d\u7684\u9009\u62e9\uff0c\u5bf9\u4e8e\u6211\u4e2a\u4eba\u800c\u8a00\uff0c\u9009\u62e9MooTools\u7684\u539f\u56e0\u4ec5\u4ec5\u53ea\u662f\u56e0\u4e3a\u6211\u80fd\u6700\u7ec8\u7528\u8bed\u8a00\u8868\u73b0\u51fa\u6765\u4e00\u4e9b\u4e1c\u897f\u3002\u6240\u6709\u7684\u6846\u67b6\u90fd\u7528\u4e0d\u540c\u7684\u65b9\u5f0f\u8fbe\u5230\u4e86\u7c7b\u4f3c\u7684\u76ee\u7684\uff0c\u4f46\u662f\uff0c\u81f3\u5c11\u5bf9\u4e8e\u6211\u800c\u8a00\uff0cMooTools\u518d\u4e00\u6b21\u5e2e\u52a9\u6211\u89e3\u51b3\u4e86\u6211\u7684\u8bbe\u8ba1\u548c\u5b9e\u73b0\u6311\u6218\uff0c\u8fd9\u5c31\u662f\u6211\u8db3\u591f\u660e\u786e\u7684\u7406\u7531\u3002<\/p>\n<p>\u4e0a\u4e00\u7bc7\uff1a<a href=\"http:\/\/fdream.net\/blog\/article\/588.aspx\" target=\"_blank\" title=\"[\u7ffb\u8bd1]jQuery\u548cMooTools\u7684\u771f\u6b63\u533a\u522b\uff08\u4e0a\uff09\">[\u7ffb\u8bd1]jQuery\u548cMooTools\u7684\u771f\u6b63\u533a\u522b\uff08\u4e0a\uff09<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u770b\u8fd9\u7bc7\u4e4b\u524d\uff0c\u8bf7\u5148\u770b\u4e0a\u4e00\u7bc7\uff1a[\u7ffb\u8bd1]jQuery\u548cMooTools\u7684\u771f\u6b63\u533a\u522b\uff08\u4e0a\uff09 Extensibility &#8211; Because I Like To Tweak Things \u53ef\u6269\u5c55\u6027\u2014\u2014\u56e0\u4e3a\u6211\u559c\u6b22\u8c03\u6574\u4e00\u4e9b\u4e1c\u897f This brings me to the last big benefit that coding this way provides, assuming that you are writing your code in a way that lets you take advantage of it: extensibility. MooTools has a class based hierarchy (inspired by Dean Edwards excellent work), but don\u2019t &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[120,104,334,328],"class_list":["post-589","post","type-post","status-publish","format-standard","hentry","category-coding","tag-AJAX","tag-JavaScript","tag-jQuery","tag-mootools"],"views":15315,"_links":{"self":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/comments?post=589"}],"version-history":[{"count":0,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/589\/revisions"}],"wp:attachment":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/media?parent=589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/categories?post=589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/tags?post=589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}