Why Ruby?

Why should someone learn Ruby in 2022? Ruby was my first programming language, and although I’ve drifted elsewhere, I write Ruby every day. Many people in my network are Ruby diehards. As a result, it’s been a long time since I’ve gotten the chance to sell someone on Ruby. I’d recommend Ruby because it is optimized for developer happiness, it’s an exceptional scripting language, it grants access to Ruby on Rails, it has a fantastic community, and it provides stable work. ...

June 30, 2022

What Are the Tradeoffs of Passing Objects as React Props?

A common React pattern is to pass an object as a prop. Let’s consider the ways this can be used and tradeoffs of each. Consider a user avatar component that shows the user’s initials. You might see one in the upper right of your screen right now. What pieces of a user model should we pass to an Avatar component to achieve this? The initials? ("JW") The first and last names of the user? ("Jake Worth") Or should we pass the entire user object? (user) Read on to see each in detail. ...

June 27, 2022

Naive Implementations

A naive implementation is a programming technique that prioritizes imperfect shortcuts for the sake of speed, simplicity, or lack of knowledge. Naive implementation example What is ’naive’? Here’s the dictionary definition: naive (adjective) marked by unaffected simplicity : ARTLESS, INGENUOUS –Merriam-Webster Dictionary Let’s see it in a programming context! A pangram is a sentence that contains all the letters of the alphabet, such as: “The quick brown fox jumps over the lazy dog.” Consider this problem I borrowed from Exercism, asking us to build a function that detects pangrams. We have written a failing test that describes our desired function. ...

June 23, 2022

Authentication vs. Authorization

Authentication and authorization are two distinct concepts. Yet, I’ve found they’re sometimes used interchangeably. In this post, I’d like to define these terms. Authentication is verifying who someone is. Authorization is verifying what someone may access. Authentication Authentication is the process of verifying who someone is. Consider a person trying to enter an airport terminal. TSA says: “Who are you?” and the person presents an ID. TSA verifies it’s a legitimate ID and that the person presenting it is the person shown on the ID. When both are true, we call that person authenticated. ...

June 21, 2022

Spell Checking with Vim: Tutorial and Best Practices

I write each post for this blog in Vim. Writing in the terminal makes me feel like a programmer, even when I’m not specifically programming. In this post, I’ll share how I spellcheck in Vim. Enable Spelling Vim’s spelling help page is extensive, and can be viewed at: :help spell It suggests enabling spelling like this: :setlocal spell spelllang=en_us When you to this, you’ll see words that Vim considers misspelled in red. ...

June 15, 2022

How to Write a Perfect Bug Report (With Template)

Bugs are part of software. Reporting bugs well is a necessary skill in an ever-growing number of job titles. In this post, I’d like to explain how to write a perfect bug report and offer some bug-reporting best practices. What do I mean by ‘perfect’? A perfect bug report allows the receiver to start effectively solving the problem without additional conversation. I’ve found that it’s the standard on great teams. ...

June 13, 2022

Make a Prediction

Imagine you’re debugging, and you’re stuck. I have a technique that’s going to help. Think of an action you might take. Predict what will happen when you take that action. Take the action. Check if you were right or wrong, consider that information, and repeat. This may sound simple, but it’s incredibly powerful. Here’s how it works. Making a Prediction Imagine you’re debugging a web application, and you’re trying to understand why some data on your page looks wrong. ...

June 8, 2022

Desire Paths in Software

We’ve all seen a desire path. They are footpaths created by erosion from human and animal traffic that communicate a wish for a path that doesn’t exist. When you walk on a paved path toward a destination and notice a shortcut in the earth, that’s a desire path. It’s the way people go, rather than the way we would wish them to go. I once read about an architect who omitted footpaths in a college campus design. They built and opened the campus without them. Then, they waited for a year for the desire paths to appear. When they did, the architect paved those paths, reflecting the desires of the campus users. ...

June 5, 2022

Spend More Time Thinking Hard

Ben Kuhn’s ‘Think Real Hard’ shares a problem-solving checklist from the scientist Richard Feynman: Write down the problem. Think real hard. Write down the solution. On its face, this advice is ridiculous. If only we just sat and thought about the problem, we’d win a Nobel Prize like Dr. Feynman! But what can we learn from this idea? In this post, I’d like to explain how I’ve used this advice to solve the hard problems in my work. ...

June 1, 2022

PostgreSQL Polymorphism

Scenario: you need a database record that can belong to one record or another, but not both. Polymorphism and exclusivity. One approach is to create a polymorphic-style association at the data layer. By doing so, you’ll get data integrity built in, rather than trusting it will be enforced by each tenant at the application layer. Here’s how I’ve solved this problem in the past. The Database Migration This is a PostgreSQL example, but it could be applied to other databases. ...

May 30, 2022