Friday, November 30, 2012

A Clarification on what MooTools Class Implement does

If you search the net in the above topic "MooTools implement vs extend", you'll find loads of results.

There's a reason for that. MooTools has a quite misleading name on what "Implements" does in their framework. It's a mixin. Not an "Implement". It mixes the source's properties into the target.

"Implement" in programming terms usually means implementing an interface. I.e. crafting some concrete stuff following an abstract description. So there is an abstract->concrete momentum. There is no such momentum in MooTools' "Implement". It's a plain, non-deep copy between two independent, concrete stuff. They use it as a synonim as "apply".

Just look what they say in the docs:
Implements the passed in properties into the base Class prototypes, altering the base Class. The same as creating a new Class with the Implements property, but handy when you need to modify existing classes.
Watch the wording. First word should be "Mixes" or "Merges". I bet there would not be such an amount of incomprehension.

6 comments:

  1. It does not only mix / merge from another class. see the source. https://github.com/mootools/mootools-core/blob/master/Source/Class/Class.js#L107

    see http://jsfiddle.net/GGgEv/ - a mere merge won't run the methods of the mixin class.

    ReplyDelete
  2. I am really surprised that more people don't use mootools ,it seems so inline with what we already know with javascript, I find it much easier to understand than jQuery

    ReplyDelete
  3. I every time used to read paragraph in news papers but
    now as I am a user of net so from now I am using net
    for content, thanks to web.

    Here is my homepage: social.exhitz.com

    ReplyDelete
  4. Hey there just wanted to give you a brief heads up and let you
    know a few of the images aren't loading properly. I'm not
    sure why but I think its a linking issue. I've tried it in two different browsers and both show the same results.

    Visit my site: レイバン

    ReplyDelete
  5. Hey! I know this is kind of off topic but I was wondering if you knew where I could locate a captcha plugin for my comment
    form? I'm using the same blog platform as yours and I'm having trouble finding one?

    Thanks a lot!

    Feel free to visit my webpage greenfield

    ReplyDelete
  6. Howdy just wanted to give you a brief heads up and let you know a few of the
    pictures aren't loading properly. I'm not sure why but I think its a linking issue.
    I've tried it in two different internet browsers and both show the same outcome.

    Check out my page lotasculp

    ReplyDelete