RSSAmplifier

Blog

Lack of Imagination

Recent content on Lack of Imagination

lackofimagination.orgRSS feed ↗49 posts

Latest posts

Mocks are the Little-Death: Escaping the Mirage of Green Tests

“Mocks are the mind-killer. They are the little-death that brings total production failure. I will face my mocks. I will permit them to pass over me and through me. And when they have gone past, I will turn the inner eye to see their path. Where the mocks have gone there will be nothing. Only pure data will remain.” We’ve all walked the burning sands of the ‘Green Test,…

Beyond the README: Enforcing Application Guardrails at Runtime

You’re testing a new feature in a development environment. You click “Submit,” and a few seconds later, your phone buzzes with a real-world SMS notification. Or worse, a real customer receives a “Test” email meant for a sandbox user. While these aren’t usually “delete-the-database” disasters, they represent a fundamental failure in application…

Time-Travel Debugging: Replaying Production Bugs Locally

We’ve all had that sinking feeling. There are multiple crash reports from production. We have the exact input parameters that caused the failures. We have the stack traces. Yet, when we run the code locally, it works perfectly. We know where it broke, but we can’t see why. Was it a race condition? Did a database read return stale data that has since been overwritten? To find the cause,…

Testing Side Effects Without the Side Effects

In Managing Side Effects , we built a tiny JavaScript Effect System that treats side effects like database calls as data descriptions rather than executable promises. In a typical imperative application, business logic and side effects are inextricably linked. For example, when you write await db.checkInventory(...) , the runtime immediately reaches out to the database. Our Effect System works…

Managing Side Effects: A JavaScript Effect System in 30 Lines or Less

If you look at the source code of a typical application, you will likely find business logic tangled with database calls, HTTP requests firing off in the middle of validation rules, and try/catch blocks sprinkled here and there. The biggest casualty of this coupling is testability. How do you test a function that calculates a user’s discount? That’s easy, right? But how do you test a…

Little Big Line Array Build

After building quite a few subwoofers and 2-way speakers over the years, I was looking for something different, and line arrays fit the bill nicely. They use a large number of small-diameter drivers –sometimes as many as hundreds– and have some intriguing characteristics such as little loss of volume as you get further away, low distortion, and very slim enclosures. Designing one…

The Innocent Loop

Loops are so common in programming that we often don’t give them a second thought, but a buggy loop has potentially infinite destructive power as it mindlessly repeats its task however many times it’s asked. Back in the good or bad old days, depending on your perspective, the for loop with its manual index management was often the only game in town, with the occasional while loop…

Little Big 18" Subwoofer Build

I’ve been building subwoofers for years now, and I’ve always used car audio drivers. However, I recently started building speakers using pro-audio drivers, specifically mid-woofers and horn loaded compression drivers. I love how dynamic and clean-sounding these drivers are, so it was only natural that I decided to give pro-audio subwoofers a try. Unlike subwoofer drivers designed for…

Lessons from David Lynch: A Software Developer's Perspective

David Lynch passed away in January 2025, shortly after being evacuated from his Los Angeles home due to the Southern California wildfires. He’s perhaps best known for the groundbreaking TV series Twin Peaks , which inspired countless shows, including The X-Files, The Sopranos, and Lost. Lynch was genuinely a good human being who cared deeply for his actors and crew. He discovered…

Runtime Diagnostics: Catching Bugs as They Happen

A popular trope in science fiction movies set in space is running diagnostics whenever something goes wrong with a ship’s systems. The chief engineer might announce something like, “We’ve run a level 2 diagnostic on the thermal regulators.” This is technobabble of course, but in software development, the closest parallel to starship diagnostics we have is probably automated…

Building Valkyrie: A Compact High-Output Speaker with Smooth Directivity

Well-made hi-fi speakers sound great at low to moderate volumes, but many begin to suffer at high volume levels. Since hi-fi speakers are frequently used without a subwoofer, their designers often have to make certain trade-offs. To achieve reasonable bass, they have to use inefficient drivers that tend to distort at high volumes, assuming there is enough amplifier power before reaching that…

Writing Composable SQL using Knex and Pipelines

SQL is great! It can handle complex queries involving multiple tables, aggregations, subqueries, and joins. It can perform CRUD (Create, Read, Update, Delete) operations. It enforces data integrity through constraints like primary and foreign keys. It supports transactions, allowing multiple operations to be executed as a single unit, which can be rolled back if one of the operations fails.…

Self-documenting Code

Think back to the last time you looked at an unfamiliar block of code. Did you immediately understand what it was doing? If not, you’re not alone – many software developers, including myself, find it challenging to grasp unfamiliar code quickly. Let’s take a look at a simple JavaScript function that creates a user account: async function createUser ( user ) { if ( !…

Avoiding if-else Hell: The Functional Style

Many years ago, I took part in the development of a taxi-hailing mobile app that is still widely used today. I don’t know what kind of code they’re running now, but in those early days, the driver assignment code –if I remember it correctly– was similar in spirit to the grossly simplified example shown below: async function assignDriver ( rider , availableDrivers ) { const…

Firewalling Your Code

When writing code, you can call any function as long as it’s public, and similarly, you can access any object’s public properties or methods. Usually, access to code is all or none – a piece of code can be either public or private. Access to private code is typically controlled by the upper layer that encapsulates it. Although some languages support semi-private (also known as…

Building Valeria: A Compact Horn-Loaded Speaker

I’ve been using a pair of KEF LS50 Metas as my front speakers and my DIY KEF LS50 clone as the center channel speaker in my home theater for a while now. I’ve been generally happy with the smooth sound they produce, but there’s one thing lacking: dynamics. Granted, these are small bookshelf speakers, but they receive assistance from my DIY subwoofers, so they don’t have to…

Teaching Programming with BASIC

I started programming in GW-BASIC on an IBM PC clone running MS-DOS. Back then, many so-called home and business computers came bundled with a BASIC interpreter, mostly made by or licensed from Microsoft. And they all looked similar. You were greeted by a screen with a READY or OK prompt and a blinking cursor waiting for your input. The “screen editor” and interpreter were all in one…

I Don't Trust My Own Code

Recently, I had a conversation with a junior developer on my team. Let’s call him Alan. We were talking about a new notification feature that was going to be used to send reminder e-mails to potentially thousands of people if they had forgotten to enter certain data in the last month or so. Alan was confident that the code he had written was correct. “I’ve tested it well,”…

Easy Application Deployments with Linux

Linux comes with all the basic tools necessary to deploy an application to development and production environments, and to roll back to any past version if something goes wrong. It takes just a few commands to set everything up. Creating Application User It’s a good idea to create a user with limited privileges to deploy and run your application. Typically, your main user account has…

Back to Basics in Web Apps

In the beginning, there was only HTML. The first official HTML specification focused on semantic markup. There were minimal styling tags and attributes . It was up to the web browser how to render the markup in an HTML document. The whole specification was refreshingly simple. You could easily read it in one sitting. Over three decades later, we are still using the same HTML tags and then some .…

Beyond Foreign Keys

In a relational database, foreign keys are normally used to associate records stored in different tables. Let’s say we want to add a forum to our website where people can discuss matters related to our product. To keep things simple, we will model our forum with just three tables: user , post and topic . The relationships between the tables can be modeled by asking a few questions: Who wrote…

Software Architectures in a Nutshell

All problems in computer science can be solved by another level of indirection." – Butler Lampson The great majority of the software architectures currently in use are variations of the layered architecture, and what really sets them apart is the implementation details. Some might find this statement controversial, but in my experience, most software applications rely on code organized in…

Making Technical Decisions

Over the past two decades, I’ve worked as a software developer, tech lead, and CTO at various startups, including my own. I’ve accumulated a number of principles I use to make major technical decisions. Most of the principles outlined here were learned the hard way. You might not fully agree with all of the principles, but I hope at least some of them could help those who struggle with…

Economics of Bugs

Software development would be a lot easier without so many bugs. In a typical software application, there’s a never-ending stream of bugs as far as the eye can see. Some of the bugs make users’ lives miserable, some of them are annoying but can be dealt with workarounds, and the rest are mostly minor inconveniences. If that sounded depressing, I’m sorry, that wasn’t my…

Works On My Machine

But it works on my machine! When you work with software developers, especially those with less experience, it’s virtually guaranteed to hear one of them utter a version of the above expression when someone presents them with a situation they think is impossible (or more likely, improbable) to happen in the program they’ve written. Now, the great thing about software is that it’s…

Decoding Complex-Sounding Programming Terms with Examples

Richard Feynman, the Nobel Prize-winning physicist, developed an interest in biology while he was a graduate student at Princeton. He started attending a course in cell physiology, which required him to report on papers assigned to him. One such paper was about measuring the voltages generated by the nerves in cats: I began to read the paper. It kept talking about extensors and flexors, the…

On Unix Philosophy

I will never forget the time I discovered how web pages were made. The year was 1995. I was using Windows 3.1 like most everyone, and it didn’t even support the TCP/IP network stack out of the box. I had to install a program called Trumpet Winsock and a hot new web browser called Netscape to connect to the Internet. Netscape Navigator 1.2 on Windows 3.1 - Source: Wikipedia In Netscape, there…

DIY Dual Column Speaker Stands

I was looking to buy speaker stands for my KEF LS50 Metas and the DIY KEF LS50 Clone I use as my center channel speaker. KEF’s matching extruded aluminum S2 stands were a natural choice. Unfortunately, they were quite expensive, and I’m not really a fan of single column stands anyway, so I decided to build a few dual column stands myself. I picked 8 mm MDF for the sides of the columns,…

One Function Per Line

It’s often said that reading code is harder than writing it, but is it really? If that were the case for books, everyone would be writing their own rather than reading the books others wrote. But, a page of code isn’t equivalent to a page of text. Code, by nature, is denser. To effectively explain what a page of code does may easily take several pages, and in some cases a lot more. Is…

Writing Robust Code via Idempotence

What happens when a function call fails? Can you retry without causing any unintended side effects? If the answer is no, then your function is probably not robust enough. Here is a scenario that is very likely happening to someone somewhere right at this moment. Let’s call this person Midori. Midori has been eyeing a pair of headphones, fancy noise cancelling ones, no less, and as soon as…

Common SQL Mistakes Developers Make

Over the years I’ve seen all sorts of SQL mistakes made by developers on my teams, and I’ve made quite a few of them myself. I’d like to share what I’ve learned with you, starting with security first. Table of Contents Security Writing Raw SQL queries Not Using Prepared Statements Data Integrity Missing Primary Keys Missing Foreign Keys Not Using Transactions No ORDER BY…

Practical Defensive Programming

“Only the paranoid survive.” – Andy Grove No software developer in their right mind would trust user inputs in an application. All user inputs need to be validated and sanitized, otherwise nasty security vulnerabilities like SQL injection and Cross-Site Scripting (XSS) attacks might happen. Once user inputs pass validation and start to go through internal layers of code, many…

Making a KEF LS50 Clone

KEF makes some of the best coaxial speakers in the market, and they use the same driver platform in all their speakers ranging from the entry-level Q series to all the way up to Blade. The drivers in their higher end speakers usually have stronger motors and better crossovers, but the higher prices don’t always justify the level of performance improvements. KEF Q150 and LS50 Meta side by…

Design Patterns vs. First Class Functions

Design Patterns: Elements of Reusable Object-Oriented Software is an influential book that describes around two dozen software programming patterns. Over the years much has been written about those patterns to make the confusing parts easier for generations of developers – additional books got published and endless discussions on things like the difference between “Abstract…

Debugging is Programming

First things first… How to write production quality code in 12 steps: Understand the problem. Divide the problem into smaller chunks if possible. Choose the data structures and algorithms to use for the solution. Write the code. Run the code. Be surprised if it runs on the first try. Otherwise, fix any errors the compiler has thrown at you. Test the program behavior. If it functions…

Writing Testable Code: A Simpler Way

There are many ways to write automated tests, and you may have heard about test doubles as a way to make testing easier. Some parts of our code can be hard to test, so we replace those parts with fake test doubles. The main reason for this is that external components, such as databases and web services, cannot easily be restored to a consistent state for each test run. For example, if you’re…

Three Aspects of B2B Software Development

B2B (Business-to-Business) software is different from B2C (Business-to-Consumer) software for several reasons, but the most important one is this: In B2B, each customer isn’t an individual but a company with its own unique needs and workflows. If your software isn’t compatible with the way a company operates and there are no convenient workarounds, you risk losing their business, which…

Small Software Development Team Structure

I’ve worked at software development startups including my own throughout my career. I’ve worked as a software developer, tech lead, and CTO. I’ve written code, managed servers, created user interfaces, designed web sites, prepared documentation, and even done some marketing. I’ve hired and assisted in hiring dozens of people: both developers and non-developers. But, first…

Three Power Amp Fan Mods

I use pro audio power amps in my home theater. They provide tons of power for little money. There is one major downside though. Most models feature noisy fans, and for a good reason – pro audio power amps are often run at their limits, and many manufacturers prefer to err on the side of caution. For home use though, you can usually get away with replacing the built-in fans with quieter ones…

CNC Router Control Box Wiring

A few months ago, I bought an entry-level CNC router from a local supplier, knowing full well that I would probably need to modify it extensively. The price of the machine was right, and in case I decide to build a better one on my own, this machine would be a good starting point to learn how all the parts are connected together. The machine performed OK as long as I didn’t push it hard. I…

Three Stages of Software Development

There are a lot of things to consider before starting to write code: Which software libraries to choose? Use SQL or NoSQL? What would the database schema look like? Would we need a caching system to handle heavy traffic? How should the code be structured? And so on… These questions are certainly important, but we live in an era of fast-changing and often ill defined user requirements. The…

Subwoofers for Home Use: An In-depth Guide

Subwoofers are probably the most misunderstood and difficult-to-integrate components of a music or home theater system. However, when integrated properly, they have the potential to elevate your speakers to a whole new level. Over the years, I’ve bought and built quite a few subwoofers, and I’d like to share what I’ve learned about them with you. The first few sections of this…

All Software have Bugs

All Software have Bugs It’s inevitable. You fix some, New ones appear. You fix some more, Old ones come back from the dead Unless your tests catch them first. Do you even have time for tests When the feature backlog is a mile long, And time to market is everything. There is this satisfying feeling though When you have the scalpel in your hand, Removing features left and right, Cutting…

Favorite Exercise

I don’t like to exercise. I mostly think of it as a distraction, but what bothers me the most is the amount of time spent for exercise could have been dedicated to other, you know, more fun activities. We all need to exercise regularly to stay in shape and be healthy. I don’t think anyone would disagree with that, but if exercise takes too much time, I know I wouldn’t do it. So,…

Lodash, a Middle Ground between JavaScript and TypeScript

I still remember a quote from a computer magazine I read when I was 12. In an article comparing the programming languages of the time, a C developer described the Pascal programming language as “having a mother hen hovering over you, watching your every move, making sure you don’t screw up.” I didn’t fully understand it at the time, but he was most likely referring to the…

Writing from a Software Developer's Perspective

I write because I want to share what I know with others. Yet the software developer in me makes writing hard for me. See, in coding the internal structure needs to be consistent. The code we write is like a house of cards. If we make even one tiny mistake, the whole thing may come falling down. So, when I write, I try to be consistent, which is not a bad thing in itself of course, but the desire…

Our Experience with PostgreSQL on ZFS

First a little context: At Faradai we had been using PostgreSQL on the ext4 file system for a number of years until it recently became evident that the constantly growing database size (over 5 TB at the time) would start to cause issues in general performance, cloud costs, and the ability to have reliable backups. We reviewed a number of alternative file systems, and chose ZFS mainly for its…

Choose Your Cloud Dependencies Wisely

Vendor lock-in: An unfortunate condition that forces a person or company to continue using a disliked product or service just because they invested in it so much. Vendor lock-in used to affect mostly large companies using mission critical legacy applications, but as more and more companies move to the cloud, cloud providers started to rediscover the joys of vendor lock-in by offering…

About Lack of Imagination

“Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire world, and all there ever will be to know and understand.” ― Albert Einstein This is Aycan Gulez, your host ( LinkedIn | GitHub | YouTube | Mastodon ). As VP of Engineering at FreshDirect , I lead the technical strategy and execution for our…