
Red/Redshift Demo App
1 year ago
A small application to demonstrate the power of programming the DOM with ruby
-
Vimeo: About / Blog / Developers / Jobs / Community Guidelines / Community Forums / Help Center / Site Map / Merchandise
/ Get Vimeo

Previous Week
But why have events on requests with :upon and events on elements with :listen ?
User-interaction events use :listen, while code-initiated events use :upon.
This reflects on one of the problems we ran into while tearing MooTools limb from limb to include in Redshift: one of the core beliefs of MooTools seems to be that every possible action that could reasonably be associated with a given method name should be made available through that method name - this leads to methods like "set" which can do essentially anything you can imagine, with an absurdly complex argument-wrangling structure.
This makes it not only difficult to remember how to use the method correctly (a similar problem exists in Rails, with, for example, form helper arguments), but also creates a mind-breaking exercise in trying to follow the code down to where something actually takes place.
We could munge the methods :upon and :listen and differentiate them by treating an event that falls into the predetermined set of "user events" differently than a "code event" with an arbitrary name; this would move the :upon/:listen distinction deeper into the code, but not remove it. Rather than hiding that distinction from the developer, though, we believe that following even your own code becomes much easier when you recognize that events initiated by user interactions and events initiated by your objects running their :fire method are fundamentally different animals.
About halfway through the project I wrote a basic speccing library based on code in RSpec and JSSpec called RedSpec: github.com/backtik/redspec.
Like much of our Red family it contains shamelessly extracted code and concepts from other projects.
Unfortunately RedSpec was ready when all of Red and most of Redshift was done, so we're playing catchup on testing our code. This is holding us back from including contributions from other developers.