The Cost of Rework I often deal with customers who are looking to improve the way they build and manage database software. These could be small companies or large enterprises, with teams of developers trying to enhance their application software to solve new business problems. Often those enhancements require new data, with the related schema changes in a database. Even if there isn't any new data, often we need to query data in new ways, combing, filtering, aggregating, and otherwise transforming data into extra information that a business can use. Solving many of these problems is iterative by nature. Often a developer might experiment with a data model or query, trying to match a requirement they've been given. Once they produce a solution, we may find problems in testing, or far too regularly, in production. These could be data-related, where the developer hasn't considered values in their solution (zeros, blank or long strings, extreme dates, etc.). These could be logical errors, where the developer just made a mistake. There could also be a problem interpreting the requirement, or potentially the customer provided an incomplete or incorrect specification to the developer. In any of these cases, what often happens is rework. We need to re-look at the code we've written and change it in some way. This isn't a complete rewrite, but looking for the logical error, incomplete algorithm, or poorly performing structures. Then we need to (test) it and move it back through our process of deploying to QA, UAT, production and anywhere else the problem exists. The further we are in the process (closer to production) the more costly the effort to rework code. Some rework is unavoidable, but I think quite a bit isn't. If we wrote better-performing and cleaner code the first time and had a pattern for testing our code, we might avoid a fair amount of rework. I think that often developers minimize the effort required to perform rework. They think small changes are easy. After all, we already know the problem space, we've looked at it, and the fix should be quicker than the initial analysis and development. Or is it? One of the things I've seen is that everyone is busy. We are pulled in many directions by many different people and work on lots of different problems. Even when we work on the same application, it takes some time to remember the context under which we wrote the code. If it's not our code, then we spend time trying to understand how the original developer approached the problem. Without good specifications or tests, we might not view things the same and fix one problem, but create another. Automated testing should help here, as the tests should codify the understanding of the requirements, but too few database developers use automated testing for their code. Even developers who embrace testing from the application might not have sufficient test data to ensure their code will work in production. Most of us are expected to do more work to do this year than last year. We're constantly battling a lack of resources. We can't necessarily write more code, but we can learn to be more efficient. We can learn to reduce our rework by writing code better the first time. That takes some effort and knowledge. It takes working as a team, sharing successes and struggles, and adapting our code to use patterns and avoid anti-patterns. It requires some automation to embrace static code analysis and testing to avoid silly mistakes getting deployed and wasting time. More importantly, it takes support from management to spend time learning as a team to produce better code and avoid silly mistakes. A little investment in learning and practice goes a long way. Unfortunately, too many people, both staff and management, are unwilling to commit. Except in fixing bugs and spending time on rework. Far too many people see that as an regular, accepted part of software development. Steve Jones - SSC Editor Join the debate, and respond to today's editorial on the forums |