Dockerfile Gotchas

April 14, 2022   • docker

Docker builds images using a Dockerfile that contains all the instructions needed to create an image. Each instruction maps to a read-only layer stacked on top of the previous layer and is a delta of the changes from the previous layer.

This caching mechanism improves the performance and efficiency when building images. However, sometimes it can cause unintended issues. This post explains few such cases.

Read More

Turbo Internals - Setting Up the Codebase

April 13, 2022   • turbo-internals hotwire

Recently I’ve been reading the source code of the Turbo library. The code is well-written and easy-to-understand. Reading it has been a fun exercise, not just to learn the internals of Turbo, but also how experts like Sam Stephenson write their JavaScript. I took a lot of notes while reading the code, and I will share them in future posts.

This post explains how to download and set up the codebase so you can easily debug and step through it in the browser.

Read More

Testing to Ensure Not Sending Mail

April 12, 2022   • ruby testing

Today at work, I was trying to add tests for an email notification feature I wrote last week. Without going into too much detail, the way it works is that the app should only send the email under certain circumstances. So I wanted to write a test to ensure that the app was not sending an email under those conditions.

Read More

Deploying Rails Like It's 2005

April 10, 2022   • rails

After deploying web applications for so long using Heroku or other services that automate deployment, I realized that I didn’t really know everything that happens behind the scenes from taking an application from development to production. So I spent a weekend trying to deploy a Rails app to a bare metal server provisioned on AWS. It was a fun experience and I learned a lot. Here’re my notes from the entire process.

Read More

Ryan Singer on User Interface

April 9, 2022

An interface is a place where two things meet: the human and the computer. The computer has functions it can perform. The human needs inputs and outputs to take advantage of those functions. The interface is the arrangement of inputs and outputs that enable people to apply the computer’s functions to create outcomes they want - Ryan Singer

Read More

Why Choose `let` Over instance variables in RSpec

March 25, 2022

Repetitive setup code in tests makes it difficult to refactor the tests. It also distracts and shifts our focus from the business logic that we’re trying to test with the setup details. This post explains three ways to reduce the setup duplication in your tests.

Read More

Very Humble Programmer

March 20, 2022   • programming

I came across this quote from Dijkstra this morning. I had to re-read it at least 5 times to fully understand and appreciate the deeper meaning.

We shall do a much better programming job, provided that we approach the task with a full appreciation of its tremendous difficulty, provided that we stick to modest and elegant programming languages, provided that we respect the intrinsic limitations of the human mind and approach the task as Very Humble Programmers.

- Edsger Dijkstra

Read More

On Writing Well

March 15, 2022

Although I have never read any of Stephen King’s novels, I have heard about the man enough to respect him as a writer. So when I found out that he wrote a book on writing, I immediately bought a copy and read it over the weekend.

This book offers many practical ideas that will make you a better writer. In addition, many of King’s suggestions to become a better writer also apply to becoming a better programmer. Just replace writing with programming, and you are good to go.

I highly recommend reading this book, and it’s a delightful read. If you don’t have time (seriously?), your can instead read my notes.

Read More

Refactoring JavaScript to Ruby

March 10, 2022   • refactoring

So this evening I started my third reading of Martin Fowler’s great book Refactoring: Improving the Design of Existing Code. The refactoring skills this book teaches are timeless, and this is not a book that you read once and put it away. I strongly think that you have to review them regularly and apply on your codebase. Hence, I have aimed to read this book at least once a year.

However, this time I thought I’d do something different. All the examples in this book are in JavaScript. However, I have been spoiled by Ruby’s elegance and simplicity since I started learning it last year, and wanted to practice these refactorings in Ruby, instead of JavaScript. So I decided to rewrite the JavaScript examples in Ruby and work through them.

This blog post shows my rewrite attempt of the first big example that’s in JavaScript.

Read More
Page: 4 of 19