3 ms·
Write more tests. That's probably the best way for me. Writing tests forces me to write testable code. Which usually means higher quality code. It's hard to wri
by Jtsummers 7y ago
Write more tests. That's probably the best way for me. Writing tests forces me to write testable code. Which usually means higher quality code. It's hard to write tests for low quality code because you end up having fragile tests (having to change the tests because of changes in the program itself). Ideally the tests should be more like oracles, they should always work (at least until you decide to make a major redesign, not just a refactor).
Depending on your language of choice, if it has tools to initialize and manage packages/system/whatever-deliverables, make use of that to ensure good practice within the context of that language.
Build a CI/CD pipeline, even if it's just local. Most of my code never really leaves my machine (even though I use git for everything I write). I usually have a monitor running (either built into the language tooling like with `dotnet watch test` or just homegrown with `fswatch`) that executes tests/builds with every file save.
Pairing the previous two paragraphs, to avoid rewriting those scripts/tools every time I've forced myself into a habit of using good, standard organization for projects. By incorporating more testing (whether full-on TDD or not), I have to maintain the code quality a bit more.