4 ms·
why does the quality of your code matter? it matters if you plan on changing it often. visiting code just to improve it's quality will likely cause bugs and cos
by parentheses 6y ago
why does the quality of your code matter? it matters if you plan on changing it often. visiting code just to improve it's quality will likely cause bugs and cost time/money to no end. focus your energy on code that's changing most frequently or growing the fastest.
0) human angle
meet to determine what of these prevent sustainable operations or growth. if something becomes quadratically more painful in relation to team growth, deal with it quickly
determine what things are annoyances that would save real time (getting angry at the codebase costs time)
buy time from leadership; if leadership is not on-board with this, then it will always suffer
1) code review
reviewing code when a company is growing is a good way for original authors to impart knowledge or suggest architectural improvements (often ones they wish they made). it also creates accountability and a discussion forum for the items that follow.
2) testing
testing is like a ratchet and it can be used to build a punch-list of the most important things to fix over time.
coming up with a way to test that gets you a lot for a little is key at first. here's an example for an API: (1) snapshot your database, (2) make a bunch of api calls, (3) turn those api calls into test cases (there are creative ways to do this quickly), (4) run them all the time, (5) reduce the number of failing tests over time
find ways to turn your system into a function (use property based testing or fuzzing and you get a _lot_ for a little).
testing smartly is an endeavor in creativity. an ex-coworker
has recently written a lot about testing without focusing on so i needn't repeat his words (https://blog.nelhage.com https://blog.nelhage.com).
3) quality metrics and agreed-upon standards
some linters are almost free to enable. you can automatically populate the code with ignore/bypass annotations and all new code should follow the standards.
enforce these in code-review and monitor the chart of lints violated (also, lints violated per line of code) - ideally both should trend downwards
4) architectural patterns
most companies have a few key architectural pieces that matter. make patterns/base-classes/whatever to ensure you can visit those with improvements without having to code-mod each one. that's what these software tools are for.
- parentheses 6y agothere is something i recently started pondering: there's a perception vs. reality effect here too. let's say an engineer can: - implement feature X while shipping tests in 8 hours - implement feature X without tests in 10 hours if i was a manager and tests were delivered, i'd expect that the engineer wasted time on tests, when instead they could be shipping more features. so, at the detriment of the code-base developers _could_ be taking longer because of manager perceptions. this is an over-simplification. there are second-order effects that take on this shape. if i write cleaner code (even without tests), i make the next engineer's life easier. we work in an environment where it's possible these acts of future-helping go unrewarded. so, as early-stage engineers we're conditioned to avoid issues of quality.