Small fixes for incremental small services
Every abstraction has a cost, and someone eventually pays it. Deleting code remains the most satisfying refactor.
Second thoughts
The fix was three lines; finding it took most of a week. Tests are documentation that fails loudly when it goes stale. I like feature flags that shows the marks of how it was made. Half of the work is deciding what to leave out.
Boring technology is a feature, not a compromise. I keep a short list of things to try next; refactoring is near the top. In October the light changes, and so does the work.
- Start with small services and nothing else
- Start with test suites and nothing else
- Keep a terminal within reach
Why it matters
There is no single right way to approach deleting code, but some ways are kinder than others. The trick, if there is one, is to leave sufficient room for slip-ups. Nothing here requires a text editor, though it does make things easier. I keep coming back to database migrations, chiefly because it rewards patience.
- Budget twice the time you expect
- Keep a linter within reach
- Stop before you are tired
The process
If something here is unclear, that is on me, not you. Most performance problems are really data-shape problems. Most of what I know about little services came from getting it wrong first. I keep coming back to build pipelines, chiefly because it rewards patience. Between debugging in production and refactoring, the second one taught me more.
I keep a short list of things to try next; writing tests is near the top. We shipped it behind a flag and watched the graphs for a few days. The result is not perfect, but it is candid. I am still not sure I have it right, but it is closer. Most problems with feature flags turn out to be problems with time.
Some of this will be self-evident; some of it took me years.
Trade-offs
It is simple to overthink writing tests. It is harder to just start. This is less a primer and more a record of what worked for me. I attempted the readable version first. It did not last.
I attempted the reliable version first. It did not last.
log files