Reflections on building software for, and with, people.

Coders At Work: Reflections on the Craft of Programming

I’ve recently worked my way through Coders At Work: Reflections on the Craft of Programming, Peter Seibel’s oustanding collection of interviews with some of the industry’s most experienced programmers. Published in 2009 but featuring practitioners who’ve been working for decades, it’s full of wisdom both current and timeless on the craft of building software. Here are some of my favorite ideas from the book.

Continue reading...

Testing current_user In a Phoenix App the Easy Way

One of the things that’s drawn me to Elixir is how well it lends itself to test-driven development. But while testing a controller action in an Elixir application using Phoenix, I ran into a problem familiar from Ruby/Rails: how to test a controller action that requires authentication, i.e. that requires a current_user present.

Continue reading...

Simple Made Easy

We need to build simple systems if we want to build good systems.

—Rich Hickey

I’ve been rolling Rich Hickey’s talk, “Simple Made Easy,” around in my head for a while. At heart, it’s about how to write simpler software, which we all want to do, right? But our software and systems somehow end up complicated—buggy, hard to learn, and hard to change. The reason, Hickey suggests, it because we fall into the trap of mistaking simple with easy. Before his talk, I’d considered them synonyms, but the difference is crucial.

Continue reading...

The Senior Software Engineer

I’ve been building websites professionally for about 10 years now, and for most of my career have focused on getting better at writing clear, valuable, maintainable code. In many of my roles, I’ve been the sole developer on a project, so that was the best I could do. But since joining Lessonly and working on a growing team, I’ve come to realize that there’s only so much a single developer can do, and that by empowering my team, I can produce better, more lasting work than I could just by putting my nose to the grindstone.

Continue reading...

Architecture Without an End State

After he appeared on Ruby Rogues, I watched Michael Nygard’s recent talk Architecture Without an End State and found it fascinating. Nygard argues patiently and convincingly against the “One System To Rule Them All” approach to architecture, through which companies embark on multi-year plans to consolidate all of their data into a single system of record—projects which Nygard says dramatically that he has never seen reach completion. The turnover rate for CTOs is shorter than the time to complete such projects, so more commonly a new CTO will come in with a new plan (only to leave before its completion), relegating the existing plan to the dustbin of “legacy” projects.

Continue reading...

How to Count With ActiveRecord

Counting records returned from the database by ActiveRecord is quite a bit more complicated than you’d expect, but that’s the price of Rails’ magic and the invisible efficiency it gives you behind the scenes. ActiveRecord has its own implementation of Ruby’s size, any?, and empty? methods which behave differently than their array counterparts. Understanding how each works will help you write more efficient code when dealing with database records.

Continue reading...

Load Testing Rails Apps with Apache Bench, Siege, and JMeter

Your app works great in development and in production with dozens of users. Now, the marketing team wants to send out a blast: can the app handle hundreds? Thousands? How many users can it handle? These are tricky questions to parse, let alone answer, but any answer is going to involve some form of load testing.

Continue reading...