In year five with Rails I finally started contributing to high profile open source projects (ActiveAdmin, ActiveMerchant), albeit with mixed success. Understanding complex libraries written by others reacquainted me with debugging in RubyMine. In addition I published the first gems of my own using jeweler, taking my public GitHub contributions over 200 for the year. Working on OSS exposed me to Colloquy IRC and Travis CI. I contributed slightly more to StackOverflow and project related Google Groups.
At my employer our ‘mature’ Rails codebase has grown from 20 to 30KLOC, monitored soberly by Coveralls (87%), CodeClimate (2.8), Codeship CI, Rubocop, Gemnasium and Bliss. I remain committed to SublimeText, now with GitGutter and SublimeGit, and to RSpec, influenced heavily by a RSpec workshop at RailsConf 2014. New gems adopted this year included (tentatively) interactors, oink and thor. Documentation has been mildly improved using YARD.
Rarebit (creators of Sass and Haml) recently published the 2015 results of their annual Ruby survey, now in its seventh year.
This year saw a significant shift to Ruby 2.2 (40%) following the shift to 2.1 last year (50%). Only about 15% of rubyists remain with Ruby 2.0 or below. JRuby adoption remains below 5%.
For production the preferred web server remains Unicorn (40%) over Passenger (30%) though Puma adoption has reached 15% in its first year now that Rails 4 has better concurrency support.
If you are a full time Ruby developer I encourage you to participate at http://www.askr.me/ruby
Presentation yesterday at Kellog School of Management’s Coral Gables campus by Troy Knauss of Angel Resource Institute, sponsored by Accelerated Growth Partners, Kauffman Foundation and Greenberg Taurig. Angel investments are typically mid-six figure series A rounds in businesses with a low seven figure valuation. 60% of angel investors have a $1M – $2½M net worth and are looking to invest 10% or less of that across a dozen start-ups, so funding a round often requires syndicating across multiple angel funds or networks. Angels are significantly more prevalent than VCs, so most angel funded business are sold without going on to VC funding or an IPO. Angel portfolios have significant risk and volatility, but with adequate diversification a 20% return is achievable, though funds may be locked up for 3-10 years. Angel funding in the south-east US is less available, meaning investors can negotiate more restrictive terms, but less capital also puts funded businesses at a disadvantage against competitors from better funded regions. Topics covered included due diligence, term sheets, valuations and board involvement.
After ten years of development Rails is a mature framework, and a recurring theme at conferences is how to build and maintain Rails applications that are increasingly complex. Rails achieved early success as an opinionated framework that emphasizes MVC and convention over configuration, but as developers have tackled ever more ambitious projects there has been divergence as to how to structure them.
What is generally agreed is that business logic should reside in models, away from controllers, views and API implementations. This has led to ‘fat’ models and discussion of strategies to manage them such as this blog post from CodeClimate titled ‘7 Patterns to Refactor Fat ActiveRecord Models‘. An important point often missed when first learning Rails is that app/models is not intended exclusively for classes persisted with ActiveRecord as it may include other domain objects. In addition to domain objects other popular patterns used to structure code include form objects, presenters, decorators and service objects. Presenters and decorators intermediate between controllers and views, whereas service objects intermediate between controllers and models.
Presenters and decorators are probably less controversial in the Rails community and have done much to replace view helpers. Service objects, however, have been disparaged by DHH in favor of concerns, but many developers with a traditional OOP background are unconvinced by his approach. One example project that uses service objects is GitHub itself. More recently Collective Idea have published an ‘interactor’ gem that elaborates this approach.
These strategies all result in more classes, and probably the first step in managing a codebase with many classes is to introduce namespaces. The Rails class loader automatically searches sub-folders matching namespaces so source files can be arranged similarly to the namespace hierarchy. Given most developers nowadays navigate code using global search or ‘jump anywhere’ features in their text editor the neater project directory layout is of limited benefit, but namespacing can reduce name conflicts with libraries or between different areas of an application.
The next step beyond namespacing, suggested by Stephan Hagemann is to divide a project into internal engines or gems, an approach labelled Component Based Rails Architecture. An example project is provided at https://github.com/shageman/the_next_big_thing Each component has its own test suite so the scope of regression testing of any feature change is more limited. If a component proves reusable it can be split out from the original project altogether.
Beyond a component based architecture the final step to scaling a complex application is to break it apart into separate services interacting with an internal API, an approach referred to as Service Oriented Architecture (SOA). I will defer comment on the benefits and challenges of such an approach to a later post.
On the third floor of the Design Center Of The Americas, next to Fort Lauderdale airport, in the same complex as Magic Leap and OrthoSensor is a another rapidly growing startup that has been recently out of the spotlight, Chewy.com. Chewy started as MrChewy only three short years ago, founded by first timers Ryan Cohen and Michael Day, a self taught web developer and college dropout.
The original goal was to sell dog food to raise money for animal shelters, but sales rapidly took off beyond expectations. By early 2012 Mr. Chewy was included in a Forrester Research paper and a series of Wall Street Journal articles including one entitled Pets.com 2.0. This early publicity appears to have attracted the attention of Boston based Volition Capital and a pair of high profile angel investors, Mark Vadon and Kevin Hofmann: Mark Vadon is the billionaire founder of Blue Nile and Zulily and Kevin Hofmann is president of homedepot.com, a $500M+ online property.
Funding has not been disclosed, but Chewy moved into its new 15,000 sq. ft. offices at DCOTA last summer, took over a 300,000 sq. ft. distribution center in Nevada from Toys R’Us, and has hired two senior executives from Amazon to oversee finance and operations. It is only a matter of time before Chewy is back in the spotlight as one of south Florida’s most successful startups.
April 2017: Sold! $3.35B
Melissa Krinzman of Venture Architects and Krillion Ventures hosted by Startup Grind today at LAB Miami. Worked for three high profile national non-profits (including one being mentored by Peter Drucker) before starting her own firm helping entrepreneurs pitch for funding in New York. Have a sense of humour, don’t surprise your investors. Know which VCs you want to pitch based on the way they present themselves. Don’t pitch to associates, they are only empowered to say no. Know they are managing other people’s money and follow a process. Be persistent with marketing your venture to potential investors. Be aware of how a potential investor acts as a board member, especially when things do not go well. As an investor Melissa now on the other side of the table, learning to say no a lot, constantly busy and sometimes slow to respond to requests. Moved back to Miami and looking to close her third local investment through Krillion Ventures. Looking for teams, not individuals, with heart, balls and swagger: integrity, grit and the ability to fake it until you make it. The biggest mistake entrepreneurs make is raising insufficient funding to reach the next significant milestone, stranding the venture in limbo. Early stage VC investment in Miami relatively limited until this year when AGP restarted and Scout Ventures set up offices here. New York startup scene boomed over the past fifteen years, starting with events organized by accountants and lawyers before entrepreneurs started organizing their own events. Knight Foundation a significant help in Miemi, but too soon to say how things will evolve.
Wyncode recently blogged a “top 10” list of Rails development resources, what would be on my list?
Getting started on OS X with MRI Ruby you typically need to install Xcode command line tools, homebrew and rvm (with JewelryBox) or rbenv. MRI Ruby (aka. CRuby, aka. yarv) is the de facto reference implementation written in C, though JRuby has gained a following in larger enterprises. Microsoft at one time supported development of Iron Ruby for .NET but it has failed to gain much following.
Emerging in part as a reaction against the complexity of Java EE, the Rails community has tended to favor lightweight text editors such as TextMate, and now Sublime Text, over more heavyweight IDEs such as Eclipse and Netbeans, though JetBrain’s Rubymine has had some success. Vim continues to be popular with rubyists, with projects like Hermes.
If you don’t want to setup and maintain a local development environment you can now simply rent an online environment from Cloud9 or Nitrous.io. Other essential online tools include shared code repositories like GitHub and Bitbucket and bug tracking/project management tools such as Pivotal Tracker, Assembla or CodeBaseHQ.
One of the strengths of Rails is it’s excellent community maintained documentation, both guides and apidocs. Another great API resource is devdocs.io.
For online learning Code School and Rails for Zombies is a popular beginner resource, and Confreaks is great for catching up with conference presentations. Ryan Bates stopped publishing RailsCasts a year ago but Avdi Grimm has stepped in with Ruby Tapas.
Finally, one of the most important ingredients of any programming ecosystem are the libraries: Ruby Toolbox is a great place for learning about available gems from Haml to Inherited Resource, from Nokogiri to Grape and ActiveAdmin.
I hope I’ve piqued your interest to look at any one of these.
Another year with Rails already. The e-commerce project I’m leading has grown to 20kLOC with 1,400 tests maintained by an international team coordinated using Assembla. The biggest addition to our toolbox has been Airbrake and its seemingly unrelenting production bug reports. The other biggest challenge has been refactoring increasingly sophisticated factories to support the ever growing test suite. Our infrastructure has changed significantly also in the face of continuing growth, but that’s another story.
Refresh Miami event ‘Bringing your ideas to life’ at Miami Science Museum sponsored by Wyncode. Auditorium packed to capacity, reportedly 300 attendees. First Refresh Miami event for roughly half the attendees: why not a higher proportion of returnees? Roughly one third with an idea or working on a product. Last month’s event was on funding and next month will be on launching once an MVP is complete. Presentations by Ellie Cachette of Koombea and Carlos Taborda of Webbynode and Gistia Labs. Koombea bootstrapped to sixty employees in a few years, Webbynode with $1M revenue in 2010, developed Stack Fu in stealth mode without appreciating it failed to address a significant problem.