3 ms·
I love the metaphor of technical debt - you take it on with your eyes open, and sometimes you chose to pay it down. But... in larger engineering organizations
by simonw 7y ago
I love the metaphor of technical debt - you take it on with your eyes open, and sometimes you chose to pay it down.
But... in larger engineering organizations I've found that "paying off technical debt" isn't actually a particularly useful goal - because teams can use it as an excuse to work on pretty much anything!
If a team spends three months rewriting some code into a different style that they prefer, is that a useful pay down of debt?
So - I prefer more targeted debt repayment. The best approach I've seen so far is to focus on "get rid of duplicate systems". If you have two systems that solve a particular problem and you knock that down to one, you're guaranteed to have improved things - and it's very easy to explain to non-technical stakeholders why having one system is better than having to maintain two.
- cactus2093 7y ago> The best approach I've seen so far is to focus on "get rid of duplicate systems" In my experience this still requires finding the right balance, like almost anything else in programming. If you're too eager to get rid of duplication you can end up combining things that aren't actually quite the same and creating leaky abstractions that are a lot more painful than the almost-duplication was. There's also sometimes a trade-off involved. Maintaining two very similar systems can be more work/require more engineers, but maintaining one system that is used in different ways can make you more likely to introduce bugs unexpectedly if you make a change focused on one particular use without testing all the others enough. It might depend on the particular system which cost is more acceptable.
- simonw 7y agoYeah I've definitely seen people refactor code to eliminate duplication in a way that turns out to be counter-productive a few weeks later, when it turns out the two places that use the code are evolving in different directions. I'm thinking more about duplicate systems. A really common pattern in a codebase that has been around for a few years is incomplete replacements: someone builds v2 of the checkout flow, but it never quite completely reaches feature parity with v1 for all of the edge cases so both of them stuck around. Kill those!
- Aeolun 7y agoIf you refactor to avoid duplication, refactor into an interface.
- makapuf 7y agoYes it's important to keep separate things that could be seen as duplicate but the meaning of which is different and will evolve differently. By example paying user and delivery user or provisioning an IP address and a physical server.
- gitgud 7y agoTrue, if you're a really good engineer, you might implement an add() function to remove the duplicated addition everywhere...
- Aeolun 7y agoOh. That’s helpful! Makes it much easier if you ever have to modify the behavior of addition! Like, if a new discovery in math is made and it turns out that 1+1 isn’t always 2.
- Viliam1234 7y agoThe real benefits will appear at testing, where you can replace the actual addition with a mock object that expects parameters 1 and 1 and returns a fixed value 2, without having to do the calculation.
- endymi0n 7y agoI tend to agree, as I've seen it used and misused from both sides already. While the higher echelon often misses empathy for technical debt, what they need rather than a "euphemism treadmill" is real and actionable education on the _cost_ of technical debt. Likewise, engineers do tend to refactor everything and their mother when left alone with too much time and with too little education on opportunity cost and context on the big picture. The best advice I can give is first creating awareness and secondly making nonfunctional requirements part of any product negotiation. Always quantify the implicit expectation "...and it works": How long, for how many people tops, with how much possible downtime,... More often than not, business stakeholders can get away with much less than engineers think. That way, lots of technical debt and bad examples of overengineering never come up. But it's too late (and eventually, all code ends up as legacy code), these days I follow the school of https://martinfowler.com/bliki/OpportunisticRefactoring.html https://martinfowler.com/bliki/OpportunisticRefactoring.html Collect a few things that could be done way better / faster / stabler, ... — and then just convince everyone that a better architecture is the best way to get there.
- alacombe 7y ago> The best approach I've seen so far is to focus on "get rid of duplicate systems" In our case (very much performance-oriented), we're actually moving toward duplicating systems, because the cost of a centralized system (in term of latency and communication overhead) has become unbearable.
- pytester 7y agoMy approach is to highlight technical pain points during the week and at the end of the week vote on the biggest pain point and then allocate a fixed amount of time to work to fix that in the next week. Usually there are about 10-12, 7 of which can be safely ignored and 1-2 which are critical.
- vaylian 7y ago"pain points" is a good expression here. Some code inflicts more pain on the developer than other and the psychological effects should not be underestimated (=reduction of productivity due to lower morale). I also like your approach of time-boxing the fixes.
- gitgud 7y ago> ... because teams can use it as an excuse to work on pretty much anything! This is a great observation that explains the uncertainty ive had from time to time. Literally anything can be considered technical debt to someone! It's extremely vague subjective and is usually a bad reason to change/rewrite the code. Better reasons include; untestable code, scaling problems (now not predicted) and of course duplication...