Seven reasons why programmer effort isn't proportional to the number of lines of code



It is common in software development that adding just one or two lines of code to a program can take days. Programmer Matt Lacy explains the hidden work behind the code as to why a fix that looks simple when you look only at the changes takes days.

You've only added two lines-why did that take two days! Matt Lacey: Creating Better Apps

https://www.mrlacey.com/2020/07/youve-only-added-two-lines-why-did-that.html

◆1: It took time to reproduce the bug
If a bug report is vague, you'll spend a lot of time actually reproducing it. You can contact the person who reported the bug and request more information, but it can be even slower if you don't get a response or the person you're talking to is bad. Also, when reporting bugs found to developers, saying 'I do not have enough information about the bug' is 'just like showing a cheating help and doing nothing,' Lacey pointed out I am.

In addition, Lacy understands that the person who reports the bug also has a hard time, and also says that he should be grateful for reporting the bug itself. 'We would like to thank you for your bug report by using as much of the information provided as possible to make sure you know how to reproduce the bug before asking the person for more information,' Lacy said. Did.



◆2: Nobody was familiar with the company
If the reported bug is related to one of the least-used features in the software, and the code hasn't changed in the long run, it's possible that no one in-house knows about that feature. First, knowing exactly what the buggy feature is doing and spending some time investigating its interaction with the software under development can take even a few lines of code to fix.



◆ 3: Because the cause of the bug was not immediately found
It's the programmer's job not only to identify the symptoms of the bug, but to investigate the true cause of the bug in the code. For a bug whose cause is unknown, it is necessary to check the suspicious code one by one to find the cause.

“For me, “hiding a bug from the outside” and “fixing it” are not the same for me. Obscuring a bug makes it easier for other side effects to occur due to unexpected side effects. I don't like the time when we have to deal with bugs that are caused by side effects in the future,' he said, arguing the importance of ensuring that bugs are resolved.



◆ 4: I was investigating related bugs
In order to determine the cause of a bug, it is important not only to check the steps to reproduce the reported bug, but also to see if the same bug occurs with different approaches. Lacy pointed out that using only one type of reproducible step could create the misconception that there is only one bug, and you might miss problems that might be deep in your code. By trying to reproduce the bug at every step, 'you can gain valuable insight into finding the root cause of the bug and getting to the incorrect code,' Lacy said.



◆5: Because we were investigating the extent of the impact of the modification
Bugs are not 'just fixed the problematic code' and you should make sure that the code changes involved in the fix do not affect other behaviors of the software. If the modified code is related to various functions of the software, the range of impact will be large and it will take time to confirm 'Are different bugs in the range of impact?'



◆6: Because I was searching for the most suitable correction method
Some bugs have multiple fix patterns. Among them, it takes time to find the best fix pattern with a simple code, a small impact and a minimum risk. Lacy argued that the key to solving a bug is not to “fix it in a short time” but to “find a fix pattern that will not cause other bugs in the future” even if you spend time. ..



◆7: Because I was thoroughly debugging
Thoroughly testing the modified software and checking that it is working properly in all areas of impact can be time consuming. Among them, programmers who think 'I don't want other people to check whether the code I am fixing is okay' or 'I do not want anyone to find a bug' spend more time testing.

Lacy said that worse than 'fixing a bug' is 'fixing the same bug over and over', and 'when I encounter a bug, what do I do? We're always taking the time to make sure it's completely fixed so that it doesn't have to happen or be fixed again.'

in Software, Posted by darkhorse_log