All Articles

Personal Favorites

How to program in feedback loops
How to have a productive programming day
All my best programming tips
Binary search debugging
The “20 Questions” method of debugging
How to defend good code
Testing implementation vs. behavior in Rails
How I organize my Rails apps
Organizing Rails files by meaning
When used intelligently, Rails concerns are great
What is a Rails model?
How I code without service objects
How to do multi-step forms in Rails

By Category

Ruby/Rails Testing

Which test framework should I learn, RSpec or Minitest?
What are the different kinds of Rails tests and when should I use each?
What are all the Rails testing tools and how do I use them?
What level of test coverage should I shoot for?
How do I make testing a habitual part of my development work?
How do I add tests to an existing Rails project?
Should I be doing test-driven development?
How to get started with Rails testing
A Rails testing “hello world” using RSpec and Capybara
A Rails model test “hello world”
Rails model spec tutorial
The four phases of a test
How I set up a Rails application for testing
Why I organize my tests by domain concept, not by test type
Testing implementation vs. behavior in Rails
My general approach to Rails testing
What kinds of Rails tests I write and what kinds I don’t
Why DSLs are a necessary part of learning Rails testing
RSpec/Capybara integration tests: the ultimate guide
A repeatable, step-by-step process for writing Rails integration tests with Capybara
How to write a test when the test implementation isn’t obvious
Understanding Factory Bot syntax by coding your own Factory Bot
How to deal with complex Factory Bot associations in RSpec tests
Nested factories in Factory Bot: what they are and how to use them
When to use Factory Bot’s traits versus nested factories
Transient attributes in Factory Bot
Examples of pointless types of RSpec tests
The difference between let, let! and instance variables in RSpec
Why I don’t use Shoulda matchers
Ruby/Rails testing glossary
Rails testing resource roundup
Factories and fixtures in Rails
How I set up Factory Bot on a fresh Rails project
Where to start with introducing TDD to a new Rails app
Why use Factory Bot instead of creating test data manually?
How I write characterization tests
Refactoring to POROs (using tests)
How to clear up obscure Rails tests using Page Objects
Test smell: Obscure Test
Code smell: long, procedural background jobs (and how to fix it)
Testing private methods
How I test JavaScript-heavy Rails applications
RSpec mocks and stubs in plain English
How to test methods that involve puts or gets
Mystified by RSpec’s DSL? Some parentheses can add clarity
Sometimes it’s better for tests to hit the real API
How dependency injection can make Rails tests easier
Things you can ignore when getting started with Rails testing
Taming legacy Ruby code using the “Sprout Method” technique, example 1
Taming legacy Ruby code using the “Sprout Method” technique, example 2
When I use controller/request specs in Rails and when I don’t
The difference between integration tests and controller tests in Rails
The difference between RSpec, Capybara and Cucumber
The difference between system specs and feature specs
How to get RSpec to skip view specs when you generate scaffolds
RSpec hello world
Testing anti-pattern: setup data leak
Achieving blur in capybara
Capybara: expect field to have value
Logging the user in before Capybara feature specs
Why I recommend against using Cucumber
How to see your feature specs run in the browser
How to run system specs headlessly or not headlessly at will
A VCR + WebMock “hello world” tutorial
Avoiding network calls in Rails tests without using mocks, stubs or VCR
Rails scaffolding and TDD are incompatible (but that’s okay)
In which I dissect and improve a Rails test file I found on Reddit
Reader Q&A: Tommy’s question about testing legacy code

General testing

If you want to learn testing, first learn how to program in feedback loops
Keep test code and application code separate
What causes flaky tests
Why tests flake more on CI than locally
How I fix flaky tests
Why duplication is more acceptable in tests
Using tests as a tool to wrangle legacy projects
How I approach test coverage metrics
When I do TDD and when I don’t
Five benefits of automated testing
What if I want to do test-first but I find it easier to do test-after?
“We don’t have time to write tests”
Atomic commits and testing
All code eventually gets tested, it’s just a question of when and by whom
Continuous integration
How do you tell which areas of a project’s test suite need attention?
What should I NOT write tests for?

Ruby/Rails

Where to put Rails modules
How I organize my Rails apps
Organizing Rails files by meaning
The problem that ViewComponent solves for me
Rails can only take you so far
How I keep my Rails controllers organized
What to do about bloated Rails Active Record models
When used intelligently, Rails concerns are great
What is a Rails model?
Abstraction in Rails
Why I don’t buy “duplication is cheaper than the wrong abstraction”
How to do multi-step forms in Rails
How to restart Sidekiq automatically for each deployment
How to run RSpec with headless Chrome/Chromium on Alpine Linux
Active Record queries in views: when it’s bad, when it’s fine
Understanding Rails secrets/credentials
Extracting a tidy PORO from a messy Active Record model
Beware of “service objects” in Rails
How I code without service objects
Don’t wrap instance variables in attr_reader unless necessary
How Ruby’s instance_exec works
How Ruby’s method_missing works
Ruby memoization
Lessons I learned converting all my database IDs to UUIDs
My top five Rails performance tips for performance noobs
My vim setup for Rails

Ruby closures

Understanding Ruby Proc objects
Understanding Ruby closures
Understanding Ruby blocks
What the ampersand in front of &block means
The two common ways to call a Ruby block
How map(&:some_method) works
The difference between procs and lambdas in Ruby

Docker

A Docker “hello world” app
Docker concepts and terminology
The difference between Docker and Docker Compose
How to Dockerize a Rails application (“hello world” version)
My hybrid approach to Dockerizing Rails applications
How to Dockerize a Sinatra application
How run a PostgreSQL database in a Docker container
How and why to Dockerize your Rails app’s database
The two ways to Dockerize a Rails application
A Gentle Introduction to Docker for Rubyists (RubyConf 2021 workshop video)

General programming

How to program in feedback loops
The Brainpower Conservation Principle
Order and chaos
Atomic commits
How I make a Git commit
Duplication
Cohesion
Crisp boundaries
Premature generalization
All my best programming tips
Binary search debugging
The “20 Questions” method of debugging
Modeling legacy code behavior using science
How to save time and brainpower by dividing the bugfix process into three distinct steps
How to apply a bugfix
Don’t mix jobs
Don’t trust yourself
Deploy to production on day one
What a “walking skeleton” is and why I always start projects with one
What exactly makes “bad” code bad?
Why “users don’t care about code” is a bad saying
A systematic methodology for solving any programming problem
“Am I smart enough for programming?”
When to refactor
Don’t mix refactorings with behavior changes
How to avoid wasteful refactoring
Close your browser tabs
The purpose of private methods and when to use them
My take on the Single Responsibility Principle
Stuck on a programming problem? These tactics will get you unstuck most of the time
Variable name anti-patterns
Why global variables are bad
Why I think live-coding interviews are a good idea
Logical arguments for programmers
10x programmers
In defense of productivity
How to have a productive programming day
Do I have to code in my free time in order to be a good programmer?
How I approach software estimation
Common legacy project challenges and how to address them
Unlike real debt, technical debt is unavoidable
The difference between domains, domain models, object models and domain objects
How to defend good code
When good code is important and when it’s not
Human brains are no match for programming
Who’s to blame for bad code? Coders.
“Perfect is the enemy of the good” is a false dichotomy
“It’s ugly but it works”
How I make sure I really understand a feature before building it
Why small stories are better than big ones
Bugfixes don’t make good onboarding tasks
Refactorings should be atomic
How to perform hotfixes without side effects or extra stress
Why the boy scout rule is insufficient
My favorite debugging techniques
My Git aliases
Git workflow anti-patterns
My first attempt at a genetic algorithm
My second attempt at a genetic algorithm

DevOps

How to deploy a Ruby on Rails application to AWS
How to deploy a Ruby on Rails application to AWS Elastic Beanstalk
How to launch an EC2 instance using Ansible
How I wrote a command-line Ruby program to manage EC2 instances for me
How to generate a public key from a private key

Non-Technical Articles

Developer success == individual * environment
How to get traffic for a technical blog
How to get a team to get behind an engineering project
My experience speaking at 7 tech conferences in 9 months including RailsConf, RubyHACK and RubyConf India

Talks/Videos

RubyConf Pakistan – How to Make Testing a Habit
RubyConf 2021 – Workshop: A Gentle Introduction to Docker for Rubyists
Answers to Common Ruby on Rails Testing Questions by Jason Swett
RailsConf 2019 – Coding with an Organized Mind
RubyHACK 2019 – Using Tests as a Tool to Wrangle Legacy Projects
RubyConf India 2019 – Using Tests as a Tool to Wrangle Legacy Projects
Chicago Angular Meetup – Introduction to Angular 2