RailsConf: Nick's Highlights from Ruby Hoedown
I attended and spoke at Ruby Hoedown 2010. Below are my notes from the conference.
Day One (Nuby Hoedown)
David A. Black - The Well-Grounded Nuby
- Seven key points, with code examples
- Every expression evaluates to an object
- if statements and class definitions return objects
- operations are messages (==, +, etc)
- methods are messages (to_s)
- a[2] is equivalent to a.
- case is really if, elsif, etc, which is really x1.=(x0), x2.=(x0), etc.
- String === String is false! Classes define === as meaning "is the argument an instance of me"
- Objects have lookup paths they use to find the method among their associated modules and classes
- Super means keep searching for the next method up. Not necessarily the super class, could just be
in a module that was included the most recently. - instance.extend(module) will include the module into that instance, not the entire class
- every object has a singleton class that represents the instance. So the above in actually including
the module into the instance's singleton class. - there is always a "self". defaults to main:Object
Kevin W. Gisi - Dynamic Ruby for Nubies
- DSLs help bridge the gap between an idea and code, as a layer of abstraction
- I got lost :-(
Lunch
- Om nom nom
Nick Gauthier - The Six Ws of Testing
- I think it went well. Very low on technical content but many Nubies came to talk to me afterward and said they enjoyed it. I'm sure I bored the technical folks to tears. But hey, it's the Nuby Hoedown!
Matt Yoho - Gem Authoring and Deployment
- "require" loads code once, it is smart
- "load" loads the code without doing any checks
- You should not "require 'rubygems'" it should already be on the load path
- Don't use jeweler, use a real gemspec
http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/
Unsure about this, maybe the gemspec has enough automation you don't have to do this any more? - Aruba lets you write cuke specs within cuke specs. Helps with command line applications
Hack Session of DOOM
- Two features and one bug on hydra!
Scott Chacon - Getting Git
- http://gitref.org
- http://progit.org
- schacon@gmail.com (put conf name in subj when emailing questions)
- tree -a for nice tree list of a directory
- check out his slides for example of cool showoff styling and layout
http://github.com/schacon/showoff-wrangling-git - Email him to ask what he uses for his diagrams and highlights (backgrounds)
- Would be really cool to allow a [dot] keyword in showoff to interpret the following graphviz code as a diagram
- git log branchA ^branchB
show commits reachable by A but not by B
for example, I'm working on branch my-feature
git log my-feature ^master
is the stuff I've done that's not in master yet - git branch --merged
show me all branches that have been merged (safe to delete) - git branch --no-merged
show me all branches that have not been merged
Day Two
Bryan Liles - Coding in Anger (or is that Desperation?)
- Bryan Liles sings country
- "run through the problem, take no prisoners" ... "and undoubtedly do some bad things"
- "we build straw houses"
- "if you do it the wrong way just to get it done, you'll get hit in the future"
- Cargo Cult: "we're all guilty of it" and "it's bad"
- Copy-pasting other people's code without understanding it
- "Copying code is not bad"
- "It might do the right thing, but it might not be doing the right thing"
- Read the code first
- Respect the copyright
- Understand what you copy
- Don't "copy and paste"
- UNDERSTAND WHAT YOU COPY
- "It takes a big man to understand humility"
- Break a task down and constantly refine task estimates
- A desperate coder is a bad coder
bonus lightning talk: You are your own sales person
- you are the product
- you are the salesperson
Justin Love - You already use Closure
- Block based programming
- containment: f = File.read vs File.open do |f| ...; end
- You can call a proc with []
proc.call(a,b) is equivalent to proc[a,b] - duwanis in IRC: "rack of lambda"
Nick Gauthier - Grease your Suite
Matthew Bass - A/B Testing for Developers
- Choose a metric
- Do some experiments
- Compare the metrics
- Vanity for rails A/B testing
Yossef Mendelssohn - The Perpetual Novice
- Dryfus skill acquisition model
- Novice level: follow the rules, do what you're told
- Adv. Beginner: limited ability to perceive different aspects of the situation
- Competence: multitasking, handle more information, see how actions are related to goals
- Proficiency: higher level view of the task, prioritize, adapt
- Expert: no longer relying on rules and guidelines, deep & tacit understanding, intuition
- be mindful of your scenario: other people (or yourself) need to deal with the work you've done
- unconscious incompetence: you don't know what you're doing and you don't know that you don't know it
- conscious incompetence: you don't know what you're doing, but you know that you don't know what you're doing
- conscious competence: you can do it and you understand it, but you have to think about it
- unconscious competence: it is second nature to you. You know what you're doing and you don't have to try
- Dunning-krueger effect:
- when you don't know what you don't know, you don't appreciate the skill itself, and are therefore very confident of yourself.
- If you understand the skills, the more competent people think they are not very competent
- You need to practice, outside your main work
- Focus on getting better, the entire time
- low level people working together can be dangerous
- a skilled person working with a lower level person need to work at the lower person's level
- Shuhari
- Shu: learning fundamental techique, rules and guidelines (acceptance)
- Ha: detach, digress, and break from tradition. think for yourself
- Ri: transcendence: moved past rules and guidelines (no form)
- Shoshyu: beginner's mind. In the beginner's mind there are many possibilities. In an expert's mind, there are few.
- Experts have a tendency to stop asking questions
- Beginners always ask questions
- Something doesn't suck just because it's old
Starcraft interlude
- Nick Gauthier vs Bryan Liles and Saxon
Ben Scofield - Keynote
- Practice is important for mastery
- Practice is not fun
- mastery is know how to do things, not just knowing what was done
- mastery is not required
- as a company, deciding what not to do is as important (or more) as deciding what to do
- Pick out what is most important to succeed, and outsource the rest
- errbit : open source alternative to hoptoad
- as a company, focus on the most important stuff
- live intentionally: think about what you're spending your time on.
- Embrace adequacy (and mediocrity)
Day Three
Family friendly ruby conf in disney world. $189/night @ contemporary. Free conference.
http://magic-ruby.com
Michael Jackson - Parsing Expressions in Ruby
- Different school of thought alternative to regular expressions
- Regexes are great but complicated ones get really gross, even after 10 or 12 characters
- parsing expressions are:
- declarative
- recursive
- readable
- easy to maintain
- not ambiguous
- slow :-) (in ruby)
- Citrus gem
John Willis - Configuration Management in the Cloud with Chef
- infrastructure as code
- need to be able to share with teammates
- can't have "the deploy guy"
- Chef is a library for configuration management
- Chef client runs on the system (to accept commands and configuration)
- Chef server is a RESTful API
- Each system you configure is a Node
- Attributes are searchable
- Knife is the tool you use to interact with the API
- Nodes have Roles, which describe what a Node should be
- Nodes have a Run List
- What Roles or Recipes to apply in Order
- A Resource is a Package or a Service
- E.G. Package "sudo" "1.6.8p12" and it figures out what package manager to use
- Services support actions (e.g. apache supports "restart" and "status")
- Resources take action through providers
- Data bags store arbitrary data
- E.G. put a user w/ their ssh key in a data bag, so you can add them as a user on the server
- Cookbooks are shareable
- "Open source for infrastructure"
- Open training
- Cloud service independence (swap from slicehost to rackspace just by adding credentials)
- http://www.opscode.com
- 5 chef servers for free
- @opscode @botchagalupe
- Chef beats puppet on cloud support (more vendors)
Backchannel notes
- Whiskydisk for deploy
Alex Sharp - Refactoring in Practice
- Shantytown application: you want to bulldoze it, but people live there
- testing in crucial for refactoring
- avoid the EPIC refactor
- changing the implementation without changing its behavior
- deprecate action
- for example, hoptoad a deprecation warning on old calls to actions
- helpful when there are ajax calls you are not sure about
- take out small chunks and get them under test
- lack of framework knowledge - often using existing solutions is an easy refactor
- Domain driven development & domain modeling
- Document the smells
- delete code that you aren't using
Brian Hogan - There's a Wheel for that Already
- "I don't want to use that because I don't like how it looks"
- How often is "better" really just an opinion
- Forwardable - delegate a method to another class
- Rails.root.join('config', 'x.yml')
- dir, base = path.split
- open-uri wraps net/http, net/https, net/ftp
- Tempfile (like tmpdir, but just for one file)
- x = Tempfile.new('hydra.yml')
- OpenStruct.new(Yaml.load('config.yml'))
- Observer
@@@ ruby
def initialize
add_observer MyObserver.new
end
... later
call: "changed" ! - bash alias for serving static files via webrick
I wasn't able to write it down quick enough. - PStore for storing data
- CSV is great if it doesn't need to be faster
- Home Run for datetime speedup via C extension
- Oh no, I had to catch my flight and I missed the rest of this awesome talk!
Glenn Vanderburg - Keynote
- Wasn't there. See notes from Lone Star Ruby Conf. It was probably the same talk
Want to leanr more about RailsConf, check out our other articles:
The strength of the Rails Community, as seen at RailsConf