A small application to demonstrate the power of programming the DOM with ruby

Credits

16 Likes

  • Trek Glowacki 1 year ago
    @Will Farrington the quicksilver theme is called Showcase: julius-eckert.com/project/view/2/2
  •  
  • Will Farrington 1 year ago
    Thanks!
  •  
  • collin miller 1 year ago
    Very cool demo.

    But why have events on requests with :upon and events on elements with :listen ?
  •  
  • Trek Glowacki 1 year ago
    we wanted to highlight the distinction between device-based UI input and callbacks for object state, although these are often both referred to as "events" in other javascript libraries. Internally they are two different classes (UserEvent and CodeEvent) and it's conceivable that a single object will need to react to both.
  •  
  • Jesse Sielaff 1 year ago
    @colin miller,

    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.
  •  
  • Dr Nic 1 year ago
    Very enjoyable video. Is there matching TDD support? Or how are you guys testing your Ruby->JS? Or I could go read the code I guess... :)
  • Trek Glowacki 1 year ago
    One of the hardest things about doing something new is the lack of support tools. We thought long and hard about how to write tests/specs for ruby that turns into javascript. Testing the ruby is pointless, because ultimately Red doesn't run as Ruby. Testing with existing js testing libraries wouldn't work because we had messed with core concepts like 'truth' and 'nullness' to make them match Ruby.

    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.
  •  
  • Yuli Cherkashin 3 months ago
    I'm a Python guy, but let me tell you, what you guys are doing is way amazing. What you need next (right after the TDD) is a firebug plugin to interact with Red and Redshift directly, as a sort of in-browser interpreter (the way they have it for JS). It seems daunting, but I'm sure it's doable. I think.
  •  
This conversation is missing your voice. Take five seconds to join Vimeo or log in.

Advertisement

2 Related collections

Groups Groups
Albums Albums

Statistics

  •  
    plays
    likes
    comments
  • Total
    plays 5,987
    likes 16
    comments 8
  • Nov 12th
    plays 2
    likes 0
    comments 0
  • Nov 11th
    plays 0
    likes 0
    comments 0
  • Nov 10th
    plays 2
    likes 0
    comments 0
  • Nov 9th
    plays 2
    likes 0
    comments 0
  • Nov 8th
    plays 1
    likes 0
    comments 0
  • Nov 7th
    plays 0
    likes 0
    comments 0
  • Nov 6th
    plays 3
    likes 0
    comments 0
  • Nov 5th
    plays 1
    likes 0
    comments 0
Previous Week

Downloads

Please join Vimeo or log in to download the original file. It only takes a few seconds.