Notes from Christian Nelson

Rails Database Best Practices

By on in Development, Rails

Working on an oldish Rails project, I came across some smelly ActiveRecord code that begged for some refactoring love. I also spent some time speeding up pages with slow/many database calls. Between those two experiences, I felt the inspiration to write-up some “Back to Basics” Rails Database Best Practices.

Rule #1: Let your Database do its Job

Databases are extremely feature rich and are really freakin fast when used properly. They’re great at filtering and sorting… and many other things. If the database can do it, it will do it way faster than doing the same thing in Ruby, or any other language for that matter.

You might have to learn a little bit about how DBs work, but honestly, you don’t have to go very deep to reap a majority of the benefits.

We generally use Postgres. What you choose is less important than getting to know it and using its features to make your product awesome. If you’re curious about Postgres, there are some good resources at the end of this post. We love it.

Our first, overarching rule: Let your database do what databases are good at, instead of doing it in Ruby.

Continue reading …

Elixir and Phoenix: The Future of Web APIs and Apps?

By on in Development, Elixir

Buzz has been building up around Elixir (and Phoenix) in the development community over the last year. We’re pretty excited about them too and want to share the reasons why they’ve piqued our interest and what we’ve learned so far.

We decided to kick the tires by rewriting one of our in-house web applications using Elixir and Phoenix so that we could answer the questions that are most front of mind:

  • How productive is the stack?
  • Are there any emergent benefits?
  • Are there any significant gotchas?
  • What are the performance characteristics?
  • What’s the community like?

Continue reading …

Needles in Haystacks: Find The Job that Fits You Best

By on in Everything Else

Steve McConnell wrote a book called “After the Gold Rush” that was published back in 1999. He wrote about how the software development industry would benefit by maturing and becoming a professional industry that had learned from the mistakes made during the tech bubble of the late 90s (Steve is actually better known as the author of “Code Complete,” a great book that influenced very many developers). We, as an industry, have learned a lot since then and there are far fewer colossal failures, but we still have plenty to learn about building successful software products. This is especially important when you’re considering your next gig.

The (tech) Gold Rush is still going strong, having dipped only a bit in the mid-naughts. If you’re an experienced designer, developer, or product person… you have more opportunity than most people out there. That’s a great position to be in and we should all be thankful.

All that opportunity makes deciding where to exercise your talents harder. There are many factors at play when you’re looking for a job, some of which may be obvious (e.g. size and location) and others which require looking inwards (e.g. culture, work style, and hierarchy). If you’re looking for a new gig, here are some tips that will help with the process.

Continue reading …

Tinderbox: Continuous Deployment and Better Code Reviews

By on in Events

A couple of months ago, we committed to hosting Tinderbox talks every 8 weeks. We’re excited to announce the second event in the new series, which is scheduled for Wednesday April 30th. This is what we have on the docket:

Paul Biggar, founder of CircleCI, is joining us to discuss the Many Ways of Continuous Deployment:

So… Continuous Deployment. You hear that you should be practicing continuous deployment, but nobody every pointed out that there are many different ways to do it!

This talk compares and contrasts different kinds of continuous deployment strategies. Implementation, requirements, tradeoffs will be covered. Case-studies, examining different strategies practiced at companies such as Facebook, GitHub, IMVU, Heroku and CircleCI.

We use CircleCI on many of our projects these days and think it’s pretty wonderful.

Doc Ritezel, from the Ministry of Velocity, is joining us to share some wisdom on the subject of Better Code Reviews:

Do your team’s technical discussions devolve into tense confrontations? Are you frequently confused by other people’s code changes? Is there someone who you just can’t seem to get along with? Software peer review on a modern development team is essential to healthy code and a happy team. But it’s riddled with human-sized pitfalls. Learn why talking about code in person is important, how to talk about code without burning bridges, and most importantly, how to take dread out of your workplace.

We shoot for an intimate atmosphere, great talks and insightful Q & A. We’re pretty proud of our previous events not only because the content has been good, but the questions and interactions have been high-quality. We hope you can join us.

Doors open at 6:30 and the talks begin at 7. Please RSVP at the Tinderbox meetup.

Raygun: Generating Rails Apps for the Last Year

By on in Development, Process

It was about a year ago that we first announced Raygun, our Rails applications generator. Since then, many apps have been zapped into existence, both internally at Carbon Five and in the wild. Raygun evolved over the year; it does more of some things and less of others. Let’s see what Raygun does and what has changed…


Raygun is a command-line tool, installed as a gem, that generates new Rails apps with a bunch of tweaks, settings, and other time-saving enhancements. It bakes in the libraries and recipes we find useful when building Rails apps. Rather than including everything we might need, it provides a foundation that, by and large, is applicable to most projects.


Raygun also serves as living documentation of our conventions at Carbon Five. Changes are made via pull requests, where people propose ideas and others chime in with their thoughts. It evolves in small ways all the time, as our preferences and the available tools change.

Continue reading …

Keeping it Simple: Migrating to Pundit from CanCan

By on in Development

We’ve been using CanCan for Rails Authorization on most projects for a few years now. When upgrading an internal application to Rails 4, I discovered that CanCan does not play well with strong parameters. There are some patches to make things work, but they didn’t feel right. Also, CanCan hasn’t been given much love recently; it has the signs of an abandoned project: sporadic commits, many open issues/pull-requests, poor Code Climate score, etc. This was a cue that it’s time to review the options and see how the authorization landscape has changed.

Jonas Nicklas (of Capybara fame) released Pundit about a year ago, aiming to create something simple and less “magical” than the other options available. This line of thinking resonates strongly with me. I dislike frameworks that do too much or are difficult to understand when you have a look inside. I want something that’s simple and fits just right, or something that provides a solid foundation upon which I can build something that is a perfect fit.

I decided to give Pundit a try…

Continue reading …

GoGaRuCo 2013

By on in Everything Else

We are thrilled to be one of the sponsors of the Golden Gate Ruby Conference once again. GoGaRuCo is a great event, balancing technical talks with the meta-topics that are important to all of us. We’re very psyched about what Leah, Josh, Jim, and all of the volunteers and speakers have done. Their work helps make the Ruby Community the awesome place that it is today.

We are proud to be one of the sponsors. For our third year as a sponsor we upped our involvement by running a table and hosting one of the official parties with our friends at Sharethrough: the Hacker + Maker Lounge. Rather than throwing a party at a club where it’s too loud to talk or where the primary activity is drinking, we created an event focused on the other things we’re excited about: learning and creating new things (in addition to good food and drink).


The Hacker + Maker Lounge passport.

Continue reading …

Front-End Tech Talks Next Week

By on in Everything Else

Next Wednesday, June 26th, we’re hosting a Tinderbox event featuring three tech talks on various front-end development topics. We’re excited to have a guest speaker from Cue in the line up, plus two Carbon Five developers, including Erin who’s flying up from our Santa Monica office and Ingar, one of our tech leads in San Francisco. On the menu:

  • HTML5 Multiplayer Game Development (+ Node.js) – Ingar Shu / C5
  • New Browsers, Same Vulnerabilities – David Bloom / Cue
  • Backbone.Marionette – Erin Swenson-Healey / C5

If you haven’t yet been to one of the Tinderbox events, check it out. We aim for quality in both the talks and participation. Each talk includes Q&A and if previous events are any indicator, the Q&A can be as much fun as the talks. Come early to meet other great developers.

Doors open at 6:15, and the talks start at 7 sharp. Learn more and RSVP on the Tinderbox event page.

Using HAProxy with and SSL

By on in Development, Ops

Donning my ops hat a bit over the last few months, I have learned a bit about HAProxy, Node.js, and I was pretty surprised by how little definitive information there was on what I was trying to do for one of our projects, and HAProxy can be pretty intimidating the first time around.

What and Why

  • Route all traffic through a load-balancing proxy in preparation for horizontal scale and splitting of services (i.e. X and Y axes on the AKF Scale Cube).
  • Support’s websocket and flashsocket transports. Our application sends/receives many events to/from its clients and requires low latency for a great user experience; persistent sockets help make that happen. Sadly, IE (<10) only supports Flash sockets.
  • Use TLS/SSL for all traffic for security and to help push through finicky internet infrastructure. It’s surprising how many organizations have firewalls that disallow socket traffic. SSL traffic is often allowed through.
  • Terminate SSL at the proxy so that we don’t have to deal with certs and whatnot in the application.
  • Redirect all HTTP traffic to HTTPS

To make all of this happen, I cobbled together information from a few posts and dug into the documentation to fill in the gaps. We’ve been using our HAProxy configuration for a couple of months now and it’s working well.

Continue reading …

Raygun: Hit the Ground Running When You Start Your Next Project

By on in Development

We start new Rails projects all the time, for client, side and internal projects. Each time we do the dance to get things just the way we like them. You probably have a similar process: switch the view library, set the database, use rspec, tweak this and that, etc. Even when you do it all the time, it still takes a little while to get to the point where you’re cranking on features.

We want to hit the ground running when starting a new project, so we created Raygun, an opinionated app generator. There are others out there, two that come to mind are Appscrolls and Suspenders. Folks have been talking about the “prime” stack (see Primo) too. We want something that captures how we do things at Carbon Five (at least on most of our projects).

What does the stack look like?

Continue reading …