3 ms·
> If you think of things like “good code” or “maintainable code”, what is it that comes to mind? It’s probably things that make code easier to understand, ... P
by cadamsdotcom 5mo ago
> If you think of things like “good code” or “maintainable code”, what is it that comes to mind? It’s probably things that make code easier to understand, ... Perhaps automated tests.
Perhaps automated tests?
Perhaps?
Automated tests are a powerful tool for theory building both when creating and maintaining a codebase:
Doing automated tests well enough to get the value; that is not common knowledge.
You need to make your agent witness every test fail before it’s allowed to pass (this is red-green testing, if you’re researching it that’s what it’s called online.)
Good tests should never do I/O or test third-party code (so they stay fast, so you can run them more often). You should have tests to verify behavior that’s not explicitly in the logic, verify behavior that’s obscure or hard to test manually, and tests that prevent future engineers removing the fix that saved a customer’s butt at 3am by documenting the desired behavior of the fix - in an executable way, so the test fails if someone undoes the fix, and if the test is removed, questions can be asked in review.
Automated tests are trustworthy because they are exercised on commit and on deploy. They describe (almost) enough about how the thing is supposed to work that your coding agent can explain to you what it does and how, often it can explain why, and it can tell you where the skeletons are. Start now, it’s a great investment.