I feel the need to have a little rant about MooTools and ES7 and the whole 'Array.contains' hoo-hah.
When MooTools came out in 2006, the most popular framework was Prototype. As the name suggests, it extended prototypes, as did MooTools. People still referred to making websites with JavaScript as 'DHTML', there was no trim method on strings, there wasn't even a forEach method on arrays. JavaScript was a crippled language. IE6 ruled the waves.
MooTools, Prototype, Dojo, Base2 - they made the language usable, even fun, to work with. By using an incredible feature of JavaScript, prototypical inheritance, we were able to add features to the language that made it palatable.
Be it simple methods like number.toInt, string.trim, array.forEach, or familiar programming constructs such as Class, MooTools and its ilk took JavaScript from something impossible to work with to something that you could properly use to build awesome sites, and even apps - Microsoft, IE and desktop ruled everything, and the concept of a 'web app' was but a pipedream at the time.
script.aculo.us, moofx and jQuery made it possible to animate things. We got selector engines. We got cross-browser XHR. All of a sudden JavaScript was a viable solution.
I honestly don't think JavaScript would be anywhere near what it is today if certain frameworks hadn't extended prototypes. Hindsight is a wonderful thing. If browser vendors (Microsoft) had been more committed to promoting the language, we wouldn't have had to.
It is very easy for people to slag off something built in a different era, a different industry, but I ask you this - the last time you made a website, how much of the code did you write? Did you use jQuery, require, nodeJS? Is it a Wordpress site, something built on Joomla, do you use LESS, Apache, npm? How many microframeworks do you use, powering important parts of your product, that you have no idea how it works, who wrote it, what problems they solved?
And in 8 year's time, do you expect all of the decisions you made today, with all of the work you've produced built on other's work, to still be 100% maintainable and function as you expected?
I spent so much of my time on MooTools - no regrets, I was trying to help the web, the language, in my own small way. Would I use it today? No. Do I regret any of our decisions? Some. Was it a bad thing for the Web? No.
Worst thing that we ever did? Extending Element prototype. Worst thing that happened to MooTools? Joomla adopting 1.1 for the backend. And then we changed API for v1.2.
We might one day scoff at the use of AMD and require.js when something better comes along. We might lol that people used JS animations instead of CSS animations. In 8 years time lol bitmaps why would you be so stupid to do that, why not use vector?
I have enjoyed the 'demise' of MooTools, something I spent so much of my time on. We became obsolete. That's great. The language evolved and we got the things we were looking for:
- String, Array, Number, Object extensions to make dealing with primitives workable - just basic programming methods like forEach
- querySelectorAll and - ahem - jQuery for sane DOM work (would still love to see more of this natively in browsers)
- Animations in CSS
- Cross-browser XHR
Amongst other things.
Prototype and MooTools and other frameworks that extended prototypes were great at the time, so great in fact that they became used by a huge part of the internet, at one point in time they have been the 'most used' frameworks, everyone was talking about how great the idea is, disclaimer - what is cool today will, in 8 years time, be uncool and oh god what a n00b what were they thinking?
Last point - I wonder how many JS devs today know who Dean Edwards is, or what Base2 or CSSQuery is. Probably not many. That's a shame.
Amen brother.
I was among those in the mid-2000s thinking that it was cool to extend standard prototypes, until my co-workers were like, "WTF is this method on a standard object that I can't find in the docs?" We only know what works now because of what we already tried and how well it worked.
jQuery was practically forced into a single-global design and
.noConflict()
because it was entering the fray after plenty of other libraries had claimed their territory all over the namespace. That decision turned out making jQuery more resilient and allowed convenient (but ugly) practices like loading multiple libraries on the same page. I doubt it would have happened if jQuery arrived first.Every framework and library has its set of hindsight-enhanced design decisions that the web will live with for a long time, and we need to find better ways to deal with that. Some of the problem is bit rot. We never envisioned that anyone would just build a web site and leave it alone for years, exposing ancient code to modern browsers and practices. For example there are still 170,000 web sites using jQuery 1.2.6, released in May 2008!
Dean Edwards deserves credit for sure, his JavaScript DNA lives on in many places.