Rework is when an engineer rewrites or deletes their own code that is less than 3 weeks old.
Some rework is expected. For example, a rework rate of 9-14% for a senior engineer can be normal.
Who can use this?
But unusual spikes in rework can indicate various problems. For example, an engineer could be stuck, or your project's specs may be inadequate.
Knowing when your team’s rework rate spikes helps you have timely conversations to surface potential problems.
How is rework calculated?
Flow calculates rework by examining the context of code surrounding the rework. Flow looks at git diffs before and after a rework to identify the context of code. A git diff is a block of 4 or more lines of unchanged code before or after changes.
Flow determines if multiple changes occur in the same hunk of code or in separate hunks of code. A hunk is a continuous block of code. A hunk can include removed, added or unchanged lines of code.
What is the difference between rework and new work?
The following example shows the difference between rework and new work.
An example of new work
As long as there are git diffs between each of your code changes, the changes are considered new work.
In the example, lines 69-72 and lines 73-76 are unchanged. These sets of four lines are used as git diffs to provide context around the code. Between these git diffs is a hunk of added code in lines 72 and 73. These added lines are considered new work because they are changed code between git diffs.
An example of rework
In the example, the deleted line 68 is rework. It is followed by a git diff. But because there is no git diff before line 68, it is considered rework.
Similarly, the deleted lines 77-79 and the added lines 78-108 are also considered rework. There is no git diff after these hunks.
Learn more about causes of rework and what to do about them.
How does rework impact productivity?
On Tuesday, he decided to tweak his code and checked in this change:
Notice that the last line changed. So Jason reworked Churned one line of code. Or to put it another way, he gets no credit for the line of code he wrote yesterday.
On Wednesday he decided to tweak it again and checked the following code in:
Now he’s changed the last two lines of code. Again, Jason gets no credit for yesterday’s change and he loses credit for the original line of code he checked in on Monday. In effect, Jason reworked has Churned 100% of his code this week.
Simply put, Jason did not make any contributions on Monday and Tuesday. He may be working hard but he’s not creating value for those efforts.
In our simple example, the net result was that Jason took three days to get this feature right. Now in all fairness this may or may not be his fault. The product manager may not have been clear. The spec may have changed. Or maybe Jason got the requirements wrong.
As Jason’s manager, look a little deeper as to why he keeps rewriting the same lines of code over and over again. If you’re on the lookout for spikes in rework, you can diagnose problems early and keep your team from getting discouraged.
If you need help, please email Support (opens email form) for 24/7 assistance.