"a study that shows which" best "adoption practices have better return on investment and improve software quality faster"
It would not be great! If that were the case, we would all do this, and you would just read it in DDJ.
Because no, you must accept a painful judgment.
There is no value "make X for ROI 8%". Some of the methods require significant investment. Others can be run for free.
- Unit testing (in its real sense) - Free - ROI starts immediately.
- Automatic unit testing - not free - requires automation.
- Test Driven Design and Development - Free - ROI starts immediately.
- Static code analysis - requires tools.
- Continuous integration capabilities - inexpensive but not free
You cannot know the ROI. Thus, you can give high priority to investments. Some things are easier for people than others. You must consider your team’s willingness to accept the technique.
Change Unit testing is free.
“The time taken to encode the test could be taken to encode the next function on the list.” True, testing means developers do more work, but support does less debugging. I think this is not a 1: 1 trade. A little more time spent on written (and passing) formal unit tests significantly reduces support costs.
"What about legacy code?" The fact is that freedom is a matter of cost management. If you add unit tests to legacy code, the cost is not free. So don’t do it. Instead, add unit tests as part of maintenance, bug fixes, and new development — then it's free.
“Moving is a problem” In my experience, this is a matter of several solid examples, as well as requirements for managing unit tests in addition to code. It does not require more than a whole-hand meeting to explain that unit tests are necessary, and here are some examples. He then requires that everyone report their status as “tests, written / passed tests”. You have not completed 60%, you are 232 out of 315 tests.
"he is only free on average if he works for a given project." Always true, good point.
“it takes more time, time is not free for business” You can write bad code that does not work well and requires a lot of support, or you can write good code that works and does not require a lot of support. I think that the time taken to complete the tests actually reduces the cost of support, maintenance and debugging. In my experience, the value of unit tests for refactoring dramatically reduces the time it takes to make architectural changes. This reduces the time to add features.
“I don’t think it’s an ROI right away.” In fact, one unit test has such a huge payback that it is difficult to characterize. The first test to pass will be the one who thinks that you really can trust. Having just one trustworthy piece of code is a time saver because this is the least you need to think about.
History of war
This week I had to finish the bulk data loader; it checks and downloads 30,000 line files that we accept from clients. We have a good library that we use to download some internal files. I wanted to use this module for client files. But the client files are different enough that I could see that the library module API is not suitable.
So, I rewrote the API, repeated the tests, and checked the changes. This was a significant change to the API. A lot of damage. A large number of links to the source to find all the links and fix them.
After completing the appropriate tests, I checked it. And then I repeated what I thought was not a closely related test. By email Oh. He had a failure. He tested something that was not part of the API, which also broke. Fixed. Checked again (one hour later).
Without basic unit testing, this would violate QA, would require a bug report, would require debugging and refinement. Look at the work: 1 hour of a QA person to find and report a bug + 2 hours of developer time to recover the QA script and find a problem + 1 hour to determine what to fix.
For unit testing: 1 hour to understand that the test failed and fix the code.
Bottom line . It took me 3 hours to write a test? No. But the project received three hours ago for my investment in writing the test.