News for hackers. Stuff that matters.
Re:The Human Cost of Tech Debt by whack on Wednesday August 03, 2016 @10:18PM (#12222944)
I think one important step is to recognize that bugs can and will happen in the process of cleaning up this tech debt. There are 2 things you need to do, to handle this.

1. Tell your team that cleaning up the tech debt is a major company priority, and even if some mistakes are made along the way, that's an acceptable price to pay for the benefits involved. People shouldn't let the fear of breaking something, dissuade them from cleaning up the mess.

2. Have your team invest heavily on building test/QA infrastructure, so that if they were to break something, it would get automatically caught and flagged, before it reaches production. If the advice given in bullet 1 scares you, then you need to double down here to make up for it.

I've been in teams where pull requests that significantly cleaned up the code base were literally rejected, because people were paranoid that any change at all could break something in unforeseen ways. People just bunkered up into a "if it ain't broke, don't touch it" mentality, which meant that the tech debt problem never ever improved. Ultimately, the only way to get yourself out of this hole, is by encouraging people to take risks even if it involves them sometimes failing, and building better safety nets to catch them on the occasions when they do fail.

Re:The Human Cost of Tech Debt by mixedCase on Wednesday August 03, 2016 @11:17PM (#12223159)
>I've been in teams where pull requests that significantly cleaned up the code base were literally rejected, because people were paranoid that any change at all could break something in unforeseen ways. People just bunkered up into a "if it ain't broke, don't touch it" mentality, which meant that the tech debt problem never ever improved.

Was this in a project with or without unit tests? Usually you can win over people like this by writing a test harness around the area affected, getting that through their desks, and then pushing for change.

If even that is rejected you take it upstairs and make an ultimatum or straight up quit and pat yourself in the back for a job well done, regardless of which one you picked.

Re:The Human Cost of Tech Debt by flukus on Wednesday August 03, 2016 @11:28PM (#12223190)
It's usually not simple to add unit tests to a project that weren't built with them.

Sometimes the unit tests are the technical debt...

Re:The Human Cost of Tech Debt by mjnaus on Thursday August 04, 2016 @02:21AM (#12223755)
There are other ways to test legacy code rather the applying unit testing. If no testing is present at all, unit testing is not likely the correct approach and function/integration testing (using a PhantomJS for example) might be more suitable.
Re:The Human Cost of Tech Debt by jerf on Thursday August 04, 2016 @09:18AM (#12225255)
None of the options being discussed are "simple". There isn't a simple way out of technical debt. If there were, it wouldn't be debt.

Unit tests rarely contribute much to the technical debt, because worst generally-seen case is that you can just throw them away. I've seen that, unit tests so bad they weren't usable for much. I'm yet to see a code base destroyed by trying to make it testable, whereas I've seen a ton of codebases that were made quite powerful and flexible, yet also fairly pleasant to use, because they were built to be testable.

Also, in the end I'm far more interested in "automated" testing than anybody's pedantic definitions of what "unit" or "integration" or whatever testing is. That's not the point. The point is that I ought to be able to set up an automated built server and run useful, meaningful tests on it.

Re:The Human Cost of Tech Debt by galdosdi on Thursday August 04, 2016 @03:36PM (#12227905)
Tests are great as long as there's a strict discipline (you usually need to enforce this with tooling) of never committing a change that causes any tests to fail.

Then anyone who writes a test has to make it pass, and anyone who makes a change that breaks a test has to fix it. No rotting tests that passed long ago and have been failing for months that everyone ignores because whatever

Re:The Human Cost of Tech Debt by logfromblammo on Thursday August 04, 2016 @12:48PM (#12226809)
I once encountered old code where many of the functions had an argument "bool isUnitTest". Counting the number of things that have to be wrong with the workplace in order for this to occur and to be acceptable is left as an exercise for the reader.

Worst codebase I have ever seen. The incumbents had zero interest in paying down technical debt. Unit tests were just another thing that could be used to game metrics and justify budgets.

Metaphorically speaking, the group issued predatory high-interest payday loans to keep the customer paying increasing amounts of interest on a growing amount of technical debt, forever.

Re:The Human Cost of Tech Debt by flukus on Thursday August 04, 2016 @04:42PM (#12228318)
I found that in some of our code the other day, even that wasn't enough to stop the tests from randomly failing.
Re:The Human Cost of Tech Debt by reacweb on Thursday August 04, 2016 @05:51AM (#12224463)
I have been in such a project (nuclear waste recycling). All the refactoring have been postponed until the Y2K project. All the tests had to be performed for this project. This project should have been boring (very few code was involving date), but because of this huge refactoring, it was interesting. We have removed almost all the technical debt.
Re:The Human Cost of Tech Debt by crdoconnor on Thursday August 04, 2016 @06:53AM (#12224678)
This approach will fail.

Unit tests are by their very nature tests that are tightly coupled to your code.

Tight coupling is usually the biggest component of your technical debt.

You want tests that are more loosely coupled - integration tests.

Re:The Human Cost of Tech Debt by hashkb on Wednesday August 03, 2016 @11:30PM (#12223196)
Often really awful code is covered by really awful tests.
Re:The Human Cost of Tech Debt by im_down_w_otp on Thursday August 04, 2016 @12:26AM (#12223385)
Also without mutation testing you can't have any real confidence in the quality of your tests to begin with, if they exist at all.
Re:The Human Cost of Tech Debt by crdoconnor on Thursday August 04, 2016 @06:49AM (#12224670)
>I've been in teams where pull requests that significantly cleaned up the code base were literally rejected, because people were paranoid that any change at all could break something in unforeseen ways.

That's why you need to surround the code with realistic integration tests first before changing anything.

>Ultimately, the only way to get yourself out of this hole, is by encouraging people to take risks

No, that's absolutely wrong. You need to first de-risk changes by creating a test harness that catches the bugs that terrify your developers.

Re:The Human Cost of Tech Debt by Too on Friday August 05, 2016 @01:53AM (#12230319)
Don't be afraid to break stuff yeah, as long as breaking something is a deliberate decision. Many times the root source of your technical debt is the design of your public API, it might be so bad it's hard even to create a wrapper for it. In order to ever get rid of that debt you must remove the entry point to it which means unhappy customers, make sure you have a new api ready and a transitioning path before depreciating the old one.

Unfortunately big test suites won't help for this type of refactoring though, on the contrary they might even be in your way.