Ruby Conf 2008 Last Day
A wonderful, awful idea: ruby in the browser (and oh by the way it actually works!) by Christopher Nelson
Chris thinks that while Javascript is an excellent programming language, he likes choices so why not provide people with the option to run Ruby in the browser? Also, while programming rich web apps he found that oftentimes he ended up with business objects in Javascript and in duplicate objects in Ruby. Not very DRY. He wanted to be able to use his Ruby logic server-side and in the browser.
Two ideas that didn't work out:
JRuby - the java security manager stopped him from doing just about anything
Silverlight wasn't available for his operating system when he started the project
Rubyjs is what he ended up using. Rubyjs is a ruby compiler that uses ParseTree to produce javascript.
http://github.com/superchris/rubyjs
The translation is, of course, not without some changes:
Strings become Immutable strings
Procs become Functions
Hashes becomes custom hash object
Chris then showed us a hangman game written in Ruby, then compiled to javascript. We peeked under the covers to look at the outputted Javascript and it's not very pretty. Neither is bytecode, I expect.
You can do Class level meta programming. You can even do method_missing (which resource intensive) in Rubyjs.
He wrote a rails plugin so you can do this in your views:
<%= rubyjs "my_class", "my_method" %>
The above line, when executed, will grab my_method out of my_class, turn it into a javascript file, write it out, and load the javascript file in the view. It's even smart enough to check last modified times to figure out if it needs to re-compile the method.
Microunit is his port of Miniunit so that he can test his rubyjs code.
Red is another Ruby to javascript compiler -- he didn't use it, but it's worth looking into. He thinks its source code is easier to read, but it lacks some features of Rubyjs (no class level meta programming or method_missing). Red does have a very active community.
The Ruby Code Review. A Play in One Act by Jim Weirich and Chris Nelson
So this was a dramatization of a meeting between a consultant and client. Chris played an employee of MyTwitterFaceSpaceBook, who has brought in a consultant, Jim, to do a code review.
So they run the tests:
...EEE....FFF...EE...FFFFFFFFFEFEEEEEE....FFFFFFFFFFFFEEEEEEEEEEEEEE...FFFFFFEEEEFFFFFFFFFFFFFFFF........EF
etc.
Chris - "We run the new_features_test rake task"
rake new_features_test:
..................
Funny.
Jim explained the broken windows theory. Chris then explained that they've been having problems with their fixtures. They use fixtures to test validations by having invalid fixtures. Which leads to problems with other tests when invalid data blows things up.
Jim put valid_options (which returns a valid option hash) right on the model -- interesting. He says you can it somewhere else if you like. I would.
Jim recommends Continuous Integration like CC.rb. How do you cover the uncovered? Jim recommends doing it a little bit at a time. He comments out the whole untested method, then only uncomments enough to make the test pass.
While reviewing the code, they found some interesting metaprogramming -- If a user has a friend named Bob Jones, then that user gets a methods called bobjones, which returns the Bob Jones object. Awesome. Unfortunately there's a user named "Des Troy" that overwrites the Rails destroy method.
Chris and Jim had a great chemistry. Chris' "But dude, it's awesome 'cause it's metaprogramming" performance was funny and a little too real.
Seattle.rb Rocks! by Seattle Ruby Brigade
This presentation was sort of a lightning talk just for the Seattle Ruby brigade. Why do they get their own lightning talk session? 'Cause they have 90 unique gems and over 400 gem releases between them. You can check out their many projects at http://rubyforge.org/projects/seattlerb/
Eric Hodel UPnP
Eric wanted to watch movies on his Playstation three through his laptop or maybe it was the opposite -- he talked fast. So turning the PS3 into a media server? Or is the computer the media server? Anyway it looked cool.
JD Barnhart
Extended the Rad DSL to talk to the little circuit board that everyone loves: The Arduino. He made it do lots of stuff. Here's a video of it linked to some servos hitting wine glasses with tiny hammers:
http://www.vimeo.com/1272402
Here's a cool LED tower controlled with resistive strips
http://www.vimeo.com/1582919
(My buddy Josh Cronemeyer has also been messing around with the Arduino:
http://www.cuberick.com/2008/10/minchia-arduino-e-grande.html)
Phil Hagelberg Bus Scheme
What is Bus Scheme? It's Scheme implemented in Ruby while riding on the bus to work. I usually just listen to podcasts.
Ryan Davis
Confessions of a Ruby Sadist - the short version:
He's written a few projects that he uses to keep his code in line:
Autotest runs your tests behind the scenes while you code - you get notifications when you break stuff right away.
Heckle mutates your code and runs the tests again. Mutated code better not pass the tests.
Flog measures the complexity of your code.
Flay finds structural similarities in code that are ripe for DRYing up.
Aaron Patterson
He wrote Nokogiri - Which is basically a lot like Hpricot but faster. And then _why the lucky stiff heard about this speed boost and re-wrote Hprocot to be faster than Nokogiri:
http://hackety.org/2008/11/03/hpricotStrikesBack.html
Oh, it is ON.
Chris thinks that while Javascript is an excellent programming language, he likes choices so why not provide people with the option to run Ruby in the browser? Also, while programming rich web apps he found that oftentimes he ended up with business objects in Javascript and in duplicate objects in Ruby. Not very DRY. He wanted to be able to use his Ruby logic server-side and in the browser.
Two ideas that didn't work out:
JRuby - the java security manager stopped him from doing just about anything
Silverlight wasn't available for his operating system when he started the project
Rubyjs is what he ended up using. Rubyjs is a ruby compiler that uses ParseTree to produce javascript.
http://github.com/superchris/rubyjs
The translation is, of course, not without some changes:
Strings become Immutable strings
Procs become Functions
Hashes becomes custom hash object
Chris then showed us a hangman game written in Ruby, then compiled to javascript. We peeked under the covers to look at the outputted Javascript and it's not very pretty. Neither is bytecode, I expect.
You can do Class level meta programming. You can even do method_missing (which resource intensive) in Rubyjs.
He wrote a rails plugin so you can do this in your views:
<%= rubyjs "my_class", "my_method" %>
The above line, when executed, will grab my_method out of my_class, turn it into a javascript file, write it out, and load the javascript file in the view. It's even smart enough to check last modified times to figure out if it needs to re-compile the method.
Microunit is his port of Miniunit so that he can test his rubyjs code.
Red is another Ruby to javascript compiler -- he didn't use it, but it's worth looking into. He thinks its source code is easier to read, but it lacks some features of Rubyjs (no class level meta programming or method_missing). Red does have a very active community.
The Ruby Code Review. A Play in One Act by Jim Weirich and Chris Nelson
So this was a dramatization of a meeting between a consultant and client. Chris played an employee of MyTwitterFaceSpaceBook, who has brought in a consultant, Jim, to do a code review.
So they run the tests:
...EEE....FFF...EE...FFFFFFFFFEFEEEEEE....FFFFFFFFFFFFEEEEEEEEEEEEEE...FFFFFFEEEEFFFFFFFFFFFFFFFF........EF
etc.
Chris - "We run the new_features_test rake task"
rake new_features_test:
..................
Funny.
Jim explained the broken windows theory. Chris then explained that they've been having problems with their fixtures. They use fixtures to test validations by having invalid fixtures. Which leads to problems with other tests when invalid data blows things up.
Jim put valid_options (which returns a valid option hash) right on the model -- interesting. He says you can it somewhere else if you like. I would.
Jim recommends Continuous Integration like CC.rb. How do you cover the uncovered? Jim recommends doing it a little bit at a time. He comments out the whole untested method, then only uncomments enough to make the test pass.
While reviewing the code, they found some interesting metaprogramming -- If a user has a friend named Bob Jones, then that user gets a methods called bobjones, which returns the Bob Jones object. Awesome. Unfortunately there's a user named "Des Troy" that overwrites the Rails destroy method.
Chris and Jim had a great chemistry. Chris' "But dude, it's awesome 'cause it's metaprogramming" performance was funny and a little too real.
Seattle.rb Rocks! by Seattle Ruby Brigade
This presentation was sort of a lightning talk just for the Seattle Ruby brigade. Why do they get their own lightning talk session? 'Cause they have 90 unique gems and over 400 gem releases between them. You can check out their many projects at http://rubyforge.org/projects/seattlerb/
Eric Hodel UPnP
Eric wanted to watch movies on his Playstation three through his laptop or maybe it was the opposite -- he talked fast. So turning the PS3 into a media server? Or is the computer the media server? Anyway it looked cool.
JD Barnhart
Extended the Rad DSL to talk to the little circuit board that everyone loves: The Arduino. He made it do lots of stuff. Here's a video of it linked to some servos hitting wine glasses with tiny hammers:
http://www.vimeo.com/1272402
Here's a cool LED tower controlled with resistive strips
http://www.vimeo.com/1582919
(My buddy Josh Cronemeyer has also been messing around with the Arduino:
http://www.cuberick.com/2008/10/minchia-arduino-e-grande.html)
Phil Hagelberg Bus Scheme
What is Bus Scheme? It's Scheme implemented in Ruby while riding on the bus to work. I usually just listen to podcasts.
Ryan Davis
Confessions of a Ruby Sadist - the short version:
- I like to hurt code
- People will press charges if you hurt them
- But code won't
- Make your code your bitch
He's written a few projects that he uses to keep his code in line:
Autotest runs your tests behind the scenes while you code - you get notifications when you break stuff right away.
Heckle mutates your code and runs the tests again. Mutated code better not pass the tests.
Flog measures the complexity of your code.
Flay finds structural similarities in code that are ripe for DRYing up.
Aaron Patterson
He wrote Nokogiri - Which is basically a lot like Hpricot but faster. And then _why the lucky stiff heard about this speed boost and re-wrote Hprocot to be faster than Nokogiri:
http://hackety.org/2008/11/03/hpricotStrikesBack.html
Oh, it is ON.
Comments
nokogiri is a clear winner in my mind.