Ruby Conf 2008 First Evening

07 Nov 2008

Better Hacking With Training Wheels by Joe Martinez

“We all have a stake in each other” – we use each other’s code in many, many libraries.

What automatically checks the quality of our code? Joe wants to encode rules in a standard way (called wheels) so that you could drop it into Training Wheels and it would enforce your rules on the code. People who write new libraries could include a wheels directory in their library which would offer suggestions.

Interesting idea – on my current project we’ve be having problems with people calling destroy_all on an ActiveRecord class for no good reason. We could define a rule that shoots out a warning every time you do that.

http://github.com/capitalist/training-wheels

NeverBlock, trivial non-blocking IO for Ruby by W. Idris Yasser

“Neverblock enables concurrent DB and network access without thew need to change the program flow” Which is awesome.

Idris said that the Evented model is good but you must adjust your code while Neverblock doesn’t need any adjustments. So you can take your Rails code, require some files, swap out the mysql driver for the Neverblock one in the database.yml and you’re done. If you use Thin that is. But still very cool

Neverblock uses Fibers (new in Ruby 1.9) which are normal methods that can be paused and resumed at will:

f = Fiber.new do
x = 5
Fiber.yield x
x = 6
Fiber.yield x
x = 7
end

puts f.resume #=> 5
puts f.resume #=> 6
puts f.resume #=> 7
puts f.resume #=> Error, dead fiber called

Fibers use less resources than Threads in Ruby.

Neverblock supports PostgreSqL and MySQL (with the MySQLPlus driver)

Neverblock also supports sockets.

Neverblock needs Rails 2.1, but not quite compatible with 2.2 yet.

Neverblock can work with Ruby 1.8 – they implemented Fiber-like things using threads.

Lightning Talks:
A nice Japanese man got up to promote RubyKaigi (Ruby Conf in Japan). He said they’d like to have more non-Japanese speakers. It is happening July 17-19th 2009.

Duby – Charles Nutter
Statically typed Ruby hybrid. For speed reasons? Yes, it is faster.

Rubists you might not know
A Japanese programmer got up and talked about two Rubyists we might not know. One was the release manager of Ruby 1.9 and the other was Itojun - the IPv6 samurai The presenter was quite upset when he talked about Itojun as he had passed away last year. By all accounts he was much loved.

Ryan Davis - Flay
Flay looks for structural similarity. It finds code that is duplicated. But since it uses ParseTree, to look at the code, it can find code that does the same thing but look different. Which is freakin’ awesome. Use it to DRY up your code.

Ryan also wrote Change so you can change the class of a Ruby object on the fly. Which is evil and he admits that. In fact he revels in it.

David Chelimsky – cucumber
Cucumber is a re-write of story runner. It now uses tree top which means stories can be in any language. Also the BDD with RSpec book is finally coming out. Beta in December, real book in April.

The Nature of Truth - Yossef Mendelssohn

truth in Ruby:
true
42
0
‘this sentence is false
[1,2,3]
[]
All of the above are true

Not true:
false
nil

sudo gem install truthy
so now you can say:
0.truethy?
and know the answer. Finally.

Conferences - are really fun
and make you stupid

Introducing Flunch the gem that tries to re-assign getters to setters and vice-versa. Cause… Um, it was fun. But it didn’t work. However if you try stupid stuff like this you will learn a lot. I think that was the point.

Test-stack
Another testing thing. Seems to be a mix and match for various levels of Rspec, shoulda, rr, and other things so you can customize your tests to taste.

At this point my computer’s battery finally gave out. It’s about 10:21 and I’m going relax in my room for a bit before I go to sleep. My presentation is at 2:10 tomorrow.

Today was a long fun day.