Posts

Showing posts from June, 2020

Pattern Overload (And Why We Love It)

hprscript: Multi-Pattern Search Without Running grep N Times Why I built it Like many other programmers, I use AI agents for code development. A lot of the work is supervising what the agent does - reading its plans, checking its diffs, and sanity-checking the code it touches. That means a lot of grep commands, run one after another, often against the same tree. At some point I started thinking this was wasteful. Each grep invocation re-reads the files, re-compiles its pattern, and pays its own startup cost. And when an AI agent is the one driving, every separate search also re-sends the surrounding context to the model - the same conversation, the same instructions, the same tool schemas - just to ask one more question of the same codebase. Ten searches mean ten round trips, ten context replays, ten walks over the data. I knew there was a library that could match many patterns at once: Intel's Hyperscan . It compiles N regexes into a single DFA and matches them all ...

Big Software Contradiction

One of the renowned books in software industry is " The Pragmatic Programmer: From Journeyman to Master ". This book offers acomprehensive set of practical guidelines for creating superior software. As I read each section, I contemplated how to implement the advise and what it would look like in practice.   The section on "The Evils of Duplication" introduced the DRY principle (Don't Repeat Yourself) - the idea of having a "single source of truth" for code functionality. My initial thought was to create functionality only once and reuse it wherever needed. This would obviously simplify maintenance and ensure changes are made in just one place if needed. The following section discussed the concept of "Orthogonality." It explained that unintended side effects can occur when fixing software code. Orthogonality means that changes over some dimension will not lead to changes in other (orthogonal) dimension. In other words we need to try to creat...