Here are the notes that I took from day 1 of the Ruby Hoedown conference. I hope I didn't misquote anyone too badly, but these are the points that stuck out to me the most.
Ruby: A Year of Innovation
Jason Seifer and Gregg Pollack
Above: Jason as "DJ Ango" (in reference to the Django framework)
- This talk is not 100% Rails (it's a Ruby conference, after all)
- We'll be talking about several cool Ruby libraries:
- Rack
- Framework A --> Rack --> Web application server
- Serves as an adapter between numerous Ruby frameworks and web servers.
- Phusion Passenger
- I needed a blog for my user group.
- I chose TextDrive for hoster, and it was painful.
- Switched to DreamHost, but it turned out to be HellHost.
- Was too slow, needed something more powerful, but wait - it's just a freakin' blog!
- Phusion Passenger came out (and it's compatible with Rack!) so you can use it with any framework (not just Rails).
- Github
- What do you get when you mix SourceForge with Facebook? [Some people from the audience yell] GitHub! [I think one of said people was Chris Wanstrath, a co-creator of GitHub]
- Features include Hardcore Forking Action!
- GitHub is more than a year old, but it's adoption has taken off in the past year.
- Many well-known projects, such as Rails itself, are now hosted there.
- [I've been hearing so much about Git, it reminds me that I really, really need to get out of my SourceSafe and Subversion habits and try a distributed version control system like Git or Mercurial]
- Ruby EventMachine
- Event processing library.
- Like Twisted for Python, Apache Mina for Java, and Poe for Perl
- You can do this stuff with threads, but its slow (and potentially deadlock dangerous).
- Evented Mongrel took EventMachine and applied it to Mongrel, but there's a catch - EventMachine is best for fast requests that aren't long-running.
- Recently built into Merb.
- Use like so: deferred_requests["/uploads", "/long_process"]
- Other alternatives: Thin, Ebb, and Starling.
- Redmine
- For awhile, Trac was the only good project management application.
- Redmine is a project management app written in Rails.
- Pool Party
- Cloud EC2 computing made easy.
- make_resourceful
- Scaffolds make it easy to generate data access code, but much of the code is duplicated.
- Helps to eliminate duplicate code from scaffolding.
- Various screencast series have launched
- Railscasts
- Peepcode
- Pragmatic Programmers screencasts
- And soon.... EnvyCasts!
- Hpricot
- doc = Hpricot.open("www.website.com") and then work on the doc object.
- Juggernaut
- Server push with Rails (uses Flash)
- Praun
- Ruby PDF generation
- Capistrano
- Deployments made easy
- Ruby Virtual Machines
- JRuby for the Java VM
- IronRuby for .Net
- Skynet
- Clones Google's map reduce functionality
- DataFabric
- Allows DB sharding for scalability
- merb
- Everything that Rails isn't
- Lightweight, JavaScript library agnostic, DB access agnostic, but still with a strong set of defaults
- Sinatra
- Very lightweight web app development.
- Hello world web app in Sinatra:
require "sinatra"
get "/" do
"Hello world
end
The Future is Now: Leveraging the Cloud with Ruby
Robery Dempsey- I'm angry because people say Rails can't scale.
- What is scalability? The ability to expand gracefully under load.
- What do you need?
- Servers
- Storage
- Access to other utilities
- Not have to buy everything up front.
- Can you do that with Ruby? Of course! ... that's the cloud
- Other ways other than using cloud computing.
- High availability cluster. A set of servers that constantly ping each other. If one goes down, then another takes over.
- Load balancing cluster. A routing mechanism directs traffic to various servers based on load.
- Grid. A loosely coupled group of servers
- A Gartner study says that by 2011, startup companies will start buying a significant portion of their infrastructure on demand.
- Amazon EC2. Neat, but you need to build reliability in yourself. I've had EC2 instances vaporized upon restart. If this is the only copy of your server, you're screwed.
- There are alternatives to manual Amazon EC2:
- Morph
- Uses EC2, but has a custom, rigid deployment mechanism.
- Doesn't even allow file-level access.
- RightScale
- Lots of configuration options.
- $2,500 setup, $500/month plus Amazon fees.
- Heroku
- Free (for now!)
- Later, will be charged based on... units of work kinda... (it's sketchy)
- Everything is done in the browser
- Automatic scaling
- Work locally, then deploy
- PoolParty
- Uses an Ubuntu EC2 AMI (Amazon machine image)
- Not production ready
- Scalr
- ElasticRails
- Morph
- So, if you go straight with EC2 yourself, a standard EC2 deployment will cost $432 for a good-sized app.
- And you have to do a lot of configuration yourself.
- His suggestion of 3rd party tools (from cheapest to most expensive and scalable):
- Morph
- Scalr
- RightScale
- There are Ruby libraries to interact with various Amazon services such EC2, S3, SimpleDB, and SQS.
- [There was a comment from the audience about a problem having mail sent from Amazon serves flagged as spam]
- [There was another comment wishing that IT department would embrace cloud computing more]
Mock Dialogue: Conversations on Testing and Mocking
Joe O'Brien & Jim Weirich- [Acted a scripted simulation of two developers working through difficult testing and mocking scenarios]
- Concept of a fluent interface. Like in jQuery:
$('form#login')
// hide all the labels inside the form with the 'optional' class
.find('label.optional').hide().end()
// add a red border to any password fields in the form
.find('input:password').css('border', '1px solid red').end()
// add a submit handler to the form
.submit(function(){
return confirm('Are you sure you want to submit?');
}); - Mentioned Psychology of Builds article. The frequency of build or test runs drop dramatically when builds last longer than 30 seconds.
- Michael Feathers guidelines for unit tests.
- [This format of presentation seems to take you along lines of a conversation that I wouldn't necessarily go, but still, the style is differentl]
- Difference between stubs and mocks: stubs fake objects that can give you data back, mocks are a little more involved.
- Flexmock and Mocha mock frameworks for Ruby
- Mocks still need to be supplemented with system tests that test the whole stack.
Ruby Best Practice Patterns
Rein Henrichs- Best practices are a current understanding, and they do change.
- Now, for a little introduction / diversion...
- The Developers Dilemma - job security decreases as code maintainability increases.
- So, to guard against this... Unfactoring!
- Taking well-designed code and purposefully making it obscure to insure job security.
- "Decomposing" methods. Naming methods incorrectly, even using Pig Latin, or other obfuscation techniques.
- But seriously, on to the real talk...
- Composed methods - try keeping methods small.
- Kent Beck - Smalltalk Best Practices
- Execution around method pattern
- How can I ensure 2 things happen? (ex: I want to open a file and ensure that it closes)
- around_filter in Rails
- Wrap an object in a block to make sure it has been completely initialized and uninitialized.
- [The "using" keyword in C#]
- Sharing objects with multiple lines in a method. Pass variable into an initializer, initialize other temp variables and have them as shared variables within the class.
- I urge people to look into Ruby libraries or various open source projects for examples of pattern usage. Ask yourself why the writers did something in a certain way.
- Be aware when code doesn't feel right to you.
- Code should be fun to write and read.
- [Comment from David Black about the idea of taste and readability. Some things he's seen that people describe as readable don't seem readable to him. Rein responds that it's a valid point; people have different tastes in music, but still humans can generally agree on what harmony is and what scales we use.]
- [Another commenter stated that it's important to separate generic patterns from Ruby idioms.]
Lightning Talks
- PJ Davis
- Web interface for God system monitoring tool
- Brian Lyles
- Test all the fucking time!
- Become obsessed with testing.
- I write code to make my specs turn green.
- Various tools:
- TestSpec
- Shoulda
- Mspec
- Cucumber
- Do not imitate the old masters, seek what they sought.
- Is there every a time when you shouldn't test? Yes, when you're not coding. If it works without tests, it works by accident.
- Yousseff Mendelsohn
- "Truthy" gem package for Ruby. Helps to ease confusing true and false evaluations in Ruby.
- Usage: variable.truthy?
- Only nil and false are false in Ruby. Really. That's it. Stop looking.
- Another guy
- Making charts with Google Charts
- gchartruby library
Keynote
Chris Wanstrath- No slides, I will just read an essay.
- In the future, Ruby will be more popular.
- People will wax philosophic about the old days of Smalltalk (when they've never actually done Smalltalk).
- The suits will come down upon us, but hopefully Ruby will stay good.
- [His talk is well-written, but quoted Wikipedia too much for my taste, and without visual slides and little content, the majority of it fell flat on me.]
- PHP has a ton of helpful methods (aka a shotgun blast of functions in the global namespace).
- I haven't made a ton of money directly from open source software, but I have gotten a lot of work indirectly from it and through my reputation gained from working on open source.
- You need to work on a side project.
- But, you say you don't have the time?
- Stop reading RSS feeds, and instead rely on aggregation sites or speakers to give you the really important news.
- Rely on people to filter for you.
- But what if people don't like it, it's already been done, or it's stupid??
- Forget it, just do a side project that you love.