Three principles for naming things

There's a saying most of us developers should be familiar with:

There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.

Naming is hard.

Over time, I've realized you can make it easier on yourself. If you're a beginner, you can follow these three general principles.

It's never ok to use a variable named "p"

Storage space is cheap. You don't need to worry about using short variable names. It's not a valid excuse.

Stop being lazy. If your variable is holding a project, call it project - don't call it "p". You should be able to come back to your code six months later, look at that line, and immediately know that "p" is a project.

So you say you have an amazing memory? It's still not an excuse. Some poor guy will have to read your code in the future and he'll think "p" stands for prick.

It's never ok to use abbreviations

Writing code is all about asking the question, "If I leave this project and come back in six months, will I know what this means?"

It's a constant battle. Another way to win this battle is to stop using abbreviations. Have you ever tried to read someone else's writing where they use a lot of abbreviations? Isn't it hard? Why would you want to use abbreviations for the next poor guy working on your project?

The exception is reserved for conventions.

For example, the HTML standard uses "src" quite a bit which everyone knows to mean source. A common abbreviation in JavaScript is "evt" which obviously stands for event (if you're familiar with JavaScript).

These are conventions which most developers have agreed upon through code review and years of experience. Don't try to invent conventions simply because you're lazy.

Don't feel bad about using variables with long names

Don't worry about long variable names. Usually, the more descriptive you are, the better.

Here's an example. Suppose you query for archived projects and need to store them in a variable. Use "archived_projects" as a name for the variable.

If you broke the rules above, you might try "ap" or "arch_proj" or "a_projects". It might seem obvious to you now, but how will you know what these mean six months from now? It's not worth it.


These principles might seem obvious to you if you've been a developer for years, but it's something we should all keep in mind as we review code and teach others. These principles aren't obvious to beginners.

If you think back to when you first started, you weren't thinking about maintaining your code. You just wanted to get the damn thing working. However, you reach a point where you need to make it easier for yourself and others.

At the very least, if you learn how to be descriptive with names, you'll help everyone around you.

The SaaS products we used in 2013

A while back I wrote a post about some of the tools we use, and I thought an updated list of all the SaaS products we use to run our business might be a nice way to end the year.

We spent just over $12,000 on hosted software in 2013, not counting our Engine Yard server hosting. While this money is a real expense, I find it to be worth every single penny and can't imagine running this business without these great tools. Hopefully there's something in here that you'll find useful too.

Developer Tools

Code ClimateIf I were give out a SaaS product of the year it would probably go to Code Climate. Derek wrote a fantastic blog post about how we use Code Climate so I won't repeat it here. It's difficult to overstate how big of an impact it's had on our team.

GithubWe use github to host most of our code repositories. It's pretty popular and you probably don't need an explanation from us as to what it is.

BeanstalkWe also use beanstalk to host some of our repositories - primarily for the fantastic deployment tools that come with it. Note, if you just need deployment tools, check out dploy.io. It's made by the same fine folks over at Wildbit.

PostmarkOur chosen provider for the transactional email delivery of all our products as well as all of our client projects. Easy to use, with a lovely interface, and built by the team at Wildbit.

Twilo and TropoTwilio and Tropo are pretty big competitors. We use them both to send and receive SMS messages for our products and customer projects alike.

FormstackWhenever we need a form that we don't want to build ourself, we use Formstack. I did a full write up of Formstack a couple years ago that's still pretty relevant.

ChartbeatIf one of our apps has a problem or a spike in users, chartbeat alerts us to this reality. 

SemaphoreHosted Continuous Integration testing for Rails applications. It links up to your Github account and runs your automated tests with every commit.

AirbrakeWhen a user of any product we build gets an error, we're alerted of the error by Airbrake. It's a great way to fix issues fast and we've even had times where we've emailed a customer to tell them we noticed they ran into an error and that it had been fixed before they even had time to email us. 

Project Management and Team Communication

BasecampThe first SaaS product I ever purchased. We still use it every day to manage our projects, communicate as a team, and work with our clients. The iOS app sets a new standard for what business apps can do on the iPhone and the web app is a joy to use. With Jason Zimdars at the helm it's never been better.

Blossom - Blossom is a card based application similar to Trello and other Agile/Kanban type tools, but it's simpler and sort of feels like a 37signals inspired product. We loved the clarity it gave us as to who was working on what, and what development state a feature was in. But we regularly struggled keeping the two in sync. If we only worked on one internal product we may very well have moved to Blossom entirely, but it's file storage and conversation features just aren't powerful enough for what we need considering the number of projects we have.

Hipchat - For group chat needs we left Campfire this year and moved to Hipchat. We like being able to quickly have one on one communications, the ability so set a status, and the desktop and mobile apps are superior than Campfire's. I should note though: there is a very real increase in interruptions with hipchat over campfire and I often consider moving back to Campfire. As of now it's a net win being on Hipchat but it's not without it's tradeoffs.

Google HangoutsWe use Google Hangouts constantly. Whether interviewing job candidates, having team discussions, or just wanting to have a conversation while feeling more connected we use google hangouts.

Sales and Marketing

BiteSize PRThis app is really more of a service powered by humans who look out for reporters who want to interview experts in a particular field. When they find a good fit they write up a pitch that you can approve which gets sent from your email. Super useful and it's how I got profiled in the Chicago Tribune.

ToutWe use tout to send a lot of emails but still sound human. Tout allows you to templatize emails that you send often so you don't have to rewrite the same things over and over again, while still allowing you to customize pieces to individual recipients.

HighriseWe use Highrise to store all customer contact information, email communications, notes and tasks for customer follow-ups.

IntercomIntercom allows you to see how people who try out your software are interacting with your product. It allows you to see who is the most active, least active, likely to convert, etc. You can also use it to message people who meet certain criteria and a host of other things. We probably only use a fraction of it's power but we still find it super useful.

LuckyOrangeA type of analytics tool, Luck Orange lets you watch how users are interacting with the marketing pages on your site so you can see how people are using it, what's working and what isn't.

Heap Analytics and KissMetricsWe used both in 2013 - neither to the extent we should. Hopefully we'll get our analytics act together in 2014 and I'll be able to share something more intelligent here next year.

SquarespaceWe started building a ton of websites for ourselves on Squarespace this year. The Tula blog, Project Idealism and the Tula documentation site are all powered by Squarespace. It's powerful, easy to use, and can be used as a website, blog or e-commerce store. I'm not exaggerating by saying that we turned down tens of thousands of dollars in revenue this year by pointing people to Squarespace because it would serve them better than a custom made website. If you need a website, check them out.

Payment Processing

RecurlyWe use recurly to process all payments that are made for our software products. I like that we aren't reliant on a single gateway for processing payments. They had a major incident this year where they basically locked themselves out from accessing credit card data stored on their systems. The way they handled it made me like them even more. We started using them before Stripe came out and I like them a lot - but if we were starting over today I'm not sure I'd choose them over Stripe.

StripeStripe powers all the credit card payments we conduct inside Tula Software. They are fantastic, and if you need to accept credit cards for anything you should check them out.

SquareSquare allows you to process credit cards with your phone. It's magic. Everyone should have a Square account.

General Business and Miscellaneous

LessAccountingThere are a ton of options for accounting software. We chose LessAccounting because it's easy to use, and the founders are super nice guys who are active in the developer community.

TickWe use tick to track our time, make sure we're hitting budgets and provide clients with detailed history of what we were working on and when we were working on it. 

TgethrTgethr is a group email application that makes it very easy to create a group email address and add people to it. Whenever I need some lightweight way to communicate with a small group of people I use Tgethr.

FreshdeskWe use freshdesk to handle all our customer support requests that come in for Tula. It's very easy to use, integrates very nicely with email, and has helped us provide great support for our Tula customers.

DropboxWe started using Dropbox more than ever this year. (And then basecamp went and built a super nice Google Docs integration so we might be moving in that direction in 2014.)

TeuxDeuxA super simple todo list that doesn't cost much money at all. 

SimplecastWe use simplecast to publish the Project Idealism podcast. I LOVE IT. It's super easy to use and makes creating and publishing a podcast as easy as writing a blog post. If you've ever thought about starting a podcast but didn't know where to start, look no further than Simplecast. 

SaaS is the new rent

When I look at this list, it reinforces my belief that SaaS is the new rent. For every one of these tools I can explain why we use them, why they are worth what they cost and how they help our team to be more efficient. 

I love each and every one of these products because they make our team and our company better.

To all of you - thanks for the great products you put out in the world - our 2013 wouldn't have been as great without you.

Rendering collections

Like anything as a developer, there are many ways to accomplish the same task.

While making some updates to code and doing some refactoring, I couldn't help but notice a smell in our logs. I hadn't really thought much about it before, but it caught my eye this time - for whatever reason.

For a code base that's been alive for two+ years, there are quite a few spots that we just haven't felt the need to touch. We've refactored heavily over the past few months, but we haven't touched everything. Our churn is almost 0 in some files for no particular reason.

This particular code smell showed up in our logs. It's a spot where we render a collection with some partials. More specifically, it's a place where we render comments for a particular user. Looking at the code now, it's obvious what we should do to improve it.

For the record, it's a file we haven't changed in over a year. And better yet, the 2nd time it's ever been changed was in late 2011.

Here's what I'm talking about:

Currently, we're using Example 1 to render comments. I've shown the code smell in the logs. My first question: Why do we need to render all of these partials? There's an obvious reason in that we have many comments. But, there must be a better way.

Use the built-in methods for rendering a collection

Most of you probably know that Rails offers a built-in way to render a collection of items with a partial. It's even optimized for you.

In Example 1, Rails doesn't know you're trying to render a collection. It simply does what you ask of it. Loop and render the item each time. It's not smart enough to tell you there's a better way.

In Example 2, you're simply providing a collection and letting Rails iterate. Not only will it iterate for you, it does it in a smart way.

In partial_renderer.rb above, there's a branching case where it checks for a collection you provide. If it sees one, it takes a slightly different approach.

It caches the partial and maps the results of the collection. It's something you can let Rails worry about.

You can see the results in the logs above. In Example 1, it looks up the partial 3 times and renders it. In Example 2, there's only one look up. You can imagine how this gets cumbersome if you're trying to render hundreds of comments.

Example 1 is O(n) in regards to looking up your partial. Example 2 is O(1). Although, to be fair, Example 2 will still have to render each partial with the proper data. Example 3 is just another way to write Example 2 (if you follow the the proper naming conventions).

Taking time to disconnect

The Chicago Tribune has a digital section called 'Blue Sky Innovation' where they talk about work, business and entrepreneurship in the new economy. They did a story about people who take time to disconnect, and happened to find me as a good fit to profile for their article. Maybe the saddest, funniest, most true thing ever written about me:

He attends yoga about three times a week, finding the moves similar to stretches he did when he was a diver in college. He found himself welcoming the hour of disconnection and realized it was the only time he was away from glowing screens.

Podcast Episode 15 - People didn't leave radio, radio left the people

In the latest episode of our podcast I'm joined by Shawn Campbell, the founder of CHIRP radio, a community radio station in Chicago.

Shawn built CHIRP from the ground up with a slew of volunteers, and now organizes over 200 people that bring 21 hours of live on air time every day.

You can hear the passion Shawn has for radio and what it means to her when she's talking, and her story is a real inspiration for anyone looking to make their dent in the world.

During the course of building CHIRP, Shawn has run web and mobile development projects, fundraising efforts, applications with the FCC and a host of other things. The workload seems almost unimaginable, and yet, she and her team built a radio station from scratch in America's third largest city.

Amazing.

As always listen right here on the blog, or subscribe to the podcast in iTunes.