Dave is leading a humors keynote on some of Ruby’s more notorious WTFs Dave still loves Ruby even though he’s been using it since ‘98! Now he’s covering some of the new stuff in Ruby 1.9 Rails changed the frontier land of Ruby into a modern civilization There is no one Ruby community Ruby is the seed from which many different communities grow
The #1 reason most startups fail is because they fail to find customers Developers are good at building software but bad at building a customer base Steve Blank’s book Finding customers can be an iterative process:
Customer Discovery
Customer Validation
Customer Creation
Company Building
Nathaniel’s keys to success
Start with Passion
Jot Down Hypotheses:
What is the problem you’re going to solve?
What is the best solution for this problem?
Who will pay for this solution?
What will they pay?
Will those with the need understand the solution?
What solutions are already available
Get Over Yourself: the odds are pretty high other people have had the same exact idea
Find Problem-Solvers - people that immediately understand your solution and will give immediate feedback and will help evangelize your product (potential co founders come from this group)
Huge Vision - Tiny First Version: create a gigantic idea then cut it into the smallest possibly product that you can bring to market
Build Your Minimum Viable Product
Start Charging Your Customers - you need to find out if people will pay to use your product (Business Model Validation) It’s OK if people aren’t willing to pay for it at first, this tells you that something needs to be tweaked If the numbers just aren’t working out it’s time to Pivot. Change an assumption about your product.
Scale By Being Remarkable - be so good that your customers can’t stop talking about you. New features are never remarkable
Scale By Being Opinionated - 37signals approach find a niche that will love your product to pieces. Understand that love and hate goes hand in hand
Find Fellow Makers - these are going to be the people most passionate about your product and will yield the best result
Don’t be afraid to talk about your idea all of the time. Nobody will steal your idea Audience Questions
Q: How do you get the word out about your site? A: Get people using it as soon as possible, get them excited and share the whole vision even though only a small piece is in production
Q: What is your best plan for coming up with a pricing model? A: Start charging early, charge more than you think the product is worth. It is easier to drop prices than raise them.
Q: What is the roadmap for current developers create a product for non-developers? A: Find a partner outside of your sphere
Q: What is the best way to get feedback from customers? A: In Steve Blank’s book he has very specific things like surveys. Most makers should just get out and actively engage their customers for feedback. Sit down with then and ask about specific problems.
Slow feedback loops with your test suite are not good Sounds like Nick is getting ready to drop a bomb for making your test suites super fast “EmptyDB” testing: all tests start with dead empty database Very intense start ups and tear downs in his projects suite Test suite with no optimization: 13min 15sec Fast Context to squish your tests together, less tear downs -> 5min 32sec Paperclip is slow because it calls ImageMagick Mock out Paperclip.run -> 3min 34sec Multi-core testing tickle and parallel_specs will pre-group the files deep-test had too much setup overhead Answer: Hydra
Makes use of your OS (Pipes and SSH)
1 environment load
All tests must be run in transactions
Hydra -> 1min 26sec Nick is doing a great job of showing how your process monitor can help you optimize your test suite Filesystem tweaks to increase IO (Linux only) noatime don’t update access time File system tweaks -> 50secs Ruby Enterprise Edition -> 25sec REE has tcmalloc which helps a lot with Hydra and Factorygirl
Major speed up from the original 13+ minutes. Pretty cool
Not done yet! Distributed Hydra Distribute your test suite over SSH -> 18sec
Design principles for a Dynamic Language Good designs are sometimes difficult to describe and recognize Bad designs are very easy to describe and recognize Jim is using The Great Fire of London as an analogy of poor design. The fire allowed designers to rebuild most of the city. Incrementally the city was rebuilt. Jim labels this the first agile project SOLID from Uncle Bob Martin Single Responsibility Principle Open/closed principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle SOLID (wikipedia)
Single Responsibility Principle A class should have one and only one reason to change When you are violating, break into pieces and use a Task Manager If you cannot describe your module in one sentence without using “and”/”or” then you are in violation
Open/Closed Principle You should be able to extend a class’s behavior without actually modifying it Instead of cloning a library and modifying, use Ruby to inherit from that library
Liskov Substitution Principle Derived classes must be substitutable for their base classes (Duck Typing) Two questions:
Dependency Inversion Principle Depend upon abstractions not on concretions Design to Interfaces (from Java) Interfaces give flexibility Because Ruby is not Strongly Typed Interfaces don’t exist. Instead we should agree upon a protocol from class to class Java => Code to Interfaces Ruby => Code to Protocols
Starting with Gupta Ruby’s GC is designed to make your life easier local variables usually live on the stack heap allocated memory must be freed or it will leak all objects are fixed size, 40 bytes The freelist is a linked list that sits on the heap pointing to the memory not currently being used After freelist is full GC will scan list to find anything not in use, if found will free then the freelist uses that new memory MRI Heap slots are RVALUEs Long overview of Objects in Ruby and some under the hood stuff (check the slides) Damato is now speaking bout GC No Ruby code in MRI can execute while garbage collection is running . (probably the reason for the slowness in Ruby?) Objects are marked for sweeping, then swept in one grand swoop MRI’s GC is simple but that simplicity prevents more advanced memory management techniques without breaking the C implementation Ruby Enterprise Edition tunes the Mark and Sweep algorithm in MRI Use ltrace (only on Linux) to trace garbage collection Ruby memory leaks don’t look like regular memory leaks. They are most likely going to be reference leaks memprof is a replacement for GDB and bleak_house for inspecting the Ruby runtime’s memory usage. memprof doesn’t change the ruby binary Back to Gupta with memprof visualization memprof looks super simple to use. Gupta is demonstrating a memory leak they found in Rails 3 beta2 Must admit this talk started out slowly but I’m pretty blown away by memprof. It looks awesome. Congrats to Damato and Gupta!
Talking about the C implementation in Ruby 1.9 Also JRuby A better understanding of the lower levels of the tech gives you a better understanding of the higher software stack YARV Ruby 1.9 VM YARV consists of about 100 files, core of the Ruby environment… not gigantic Some files are 1-1 to the Ruby class (file.c -> File class) Ruby code sent through the YACC Parser in parse.y After parse tree Ruby 1.9 sends through compile.c -> bytecodes -> vm_exec.c Pretty embarrassing how much C I’ve actually forgotten. Russ is going through the Ruby source showing how conditional branching is implemented Russ seems to have a pretty bare-bones VI config People’s careers, tons of conferences, millions of dollars is dependent upon the 2MB ‘ruby’ binary. Kind of funny when you think of it (Russ’ words) VALUE is most often a pointer to a Struct JRuby 1.8’s parser: DefaultRubyParser.y, JRuby 1.9 has a different parser For methods that get run a lot JRuby has a JIT Compiler JITCompiler.java Lesson from Russ: Ruby is your tool. Don’t be afraid to look under the hood. If we refuse to understand how Ruby works then we cannot truly understand it Ruby 1.9+ source code is a maturation over Ruby 1.8 (YARV vs MRI)
10am Deciphering Yehuda by Gregg Pollack Deciphering Yehuda Slides Yehuda and Carl have done about 60% of the Rails 3 work Major refactoring for Rails 3 Yehuda Katz + Carl Lerche = Carlhuda Instead of calling Method Missing through the code, using InstanceEval at compile time for faster results (MethodCompilation) One of Yehuda’s first commit to Rails was to replace MethodMissing with MethodCompilation (much faster) Rewrote the ActiveSupport callback system in Rails. ~10x increase in speed MicroKernal Architecture by Carl Lerche Router moved into ActionDispatch Abstract Controller - Many helpers moved into it I wish Gregg didn’t use a dark theme for his presentation… difficult to see from the back AbstractController::Base the micokernel with the bare minimum needed for dispatching ActionController::Metal and ActionMailer::Base inherit from AbstractController::Base so we should get all the helpers, loggers, etc… Much better than Rails 2.x ActionController::Metal where your Rack middleware will live ActionController::Base inherits from ActionController::Metal Gregg is doing a good job of showing just how clean the Rails 3 API is, how modular the Rails 3 stack is You’ll be able to create your own Web App Framework from anywhere in the Rails3 stack. The refactored source is much easier to read, don’t be afraid to do so alias_method_chain vs super Gregg is explaining what alias_method_chain does… always confusing using super is the ‘Ruby’ way of getting the same result as alias_method_chain ActiveSupport::Concern gives you an ‘included’ block to replace the self.included module callback method Not certain if I’m sold on ActiveSupport::Concern… seems to be a rewrite of what Ruby already supports. I thought that was the oposite direction that Yehuda was heading with Rails3 ActiveSupport::Concern makes it easy for modules to include other modules Bundler General overview of gem deployment with Rails 2.x Bundler resolves dependency resolution all at once using Depth First Search Control Flow in Bundler, lesser used is Catch and Throw In Bundler’s dependency depth first search catch/throw is used to get back to the root point for faster searching (instead of recursion?) Bryan Liles thinks Rails 3’s startup time is “slow as shit”
9:50am At the Sheraton Reston, Virginia. Lots of good talks lined up