The Carrying-Cost of Code: Taking Lean Seriously
michaelfeathers.typepad.com
michaelfeathers.typepad.com
Almost got me in trouble once, true story. I had a VP who asked another senior dev type to round up LOC stats in our product for the past month (typical ridiculous bullshit). The dev dutifully whipped together a tool that was the equivalent of counting LOC changes from SVN commits. Deleted lines counted negatively :)
Even though I was the most senior coder on the team, and at the time certainly impacting the most change in the source tree, I was riding somewhere close to zero according to his tool and had some 'splaining to do.
Most large software projects that I've been a part of hit a phase somewhere between year two and three where I think they deserve a net code loss for quite a while. There's just so much well-intentioned bullshit that gets piled on in the first year or two of a project, and often doesn't get re-evaluated.. or someone on the team is operating under the delusional belief that someday that code will serve the project well in it's current, half-assed, un-tested form.
* when it was written, by whom and to answer which need
* when was it changed and to solve which issue
* if it has been ever debugged and if any bugs where ever found inside it
When I'm chasing some nasty bug in my code and I refuse to accept it was some recent change it's incredible that 90% of the times I bang my head against the wall with some bug in a recently changed bit of code. If just my IDE could highlight the code from the last 3 commits of me and my coworkers it would ease my life so much.
The "why, what issue, what bugs" part might be addressable by literate programming. But not a lot of people try that.
[1] Or most decent editors in cooperation with your version control.
How many times is that feature used vs how many times could it be useful? (or the others suggested here who need user intervention and never allow you to code while seeing this info)
Instructions: http://stackoverflow.com/questions/223657/svn-blame-in-eclip...
Screenshot: http://wiki.c2b2.columbia.edu/informatics/index.php/Eclipse#...
This will allow you to see commit messages in the code editor on a line-by-line basis. To know if a line of code had a bug in it, you would need to make sure that that sort of information is written into commit messages. Here we use a "Fixes issue #12312" trigger in post commit hook, so that the commit, the code change and the Trac ticket are all linked.
What I need is something in the code when I'm editing it, it could be some kind of hint how "old" is the line and if I mouseover it would give me the blame information.
I will check if I can build some plugin for VS or if somebody has done it.
I use a similar idea which is very low-tech, but use the date for each line/function that is changed, like this:
v110117 Statusbar.Text (string, in::statusbar_type_info);
v110117 is simply a macro where I explain the high-level rationale/bug/functionality (which is visible on mouseover-tooltip). If you need to edit different functions to fix a bug, it is a simple search for v110117 to find all changes (the comment at the end of the line may be marked v110117a, v110117b etc to separate different issues, and the detailed explanation for the changes done in that line/function is explained there).
You will quickly see if there has been any changes in a function lately due to the date-format (vYYMMDD). A bonus is that if a function has many different changes it is immediately visible, and should be a warning that the function is complex/high maintenance.
The question helps assess their maturity. It throws some people who think software is about adding continuously. Senior people know what I mean usually.
No code has no bugs. And no-code has no bugs.
The fact of the matter is that companies can make these sorts of choices. It may be hard, but it isn't impossible.
In my experience though, once you make it a habit of adding features to placate prospects, it is a very hard habit to shake.
The problem here is that larger code is more complex, and more complex is harder to work on. The suggestion is that we impose limits on the amount of code. That seems somewhat prudent, but it does not really attack the problem: we want to make code easier to change despite it being more complex.
Just limiting code size is not really a solution. Very broadly, functionality is proportional to code size (in general, and in particular where all else stays constant -- is that not reasonable?). So limiting code size is limiting functionality -- which is setting limits on what we do. We do not want that, we want to make things easier.
Also, this limiting really amounts to re-arranging the costs. It is transferring the costs of future change into costs of current activity. But instead of paying those moved costs by doing more work now, they are paid by having less functionality now. Is that not contradictory to one of the principles of agile (or at least XP)? You do not try to predict the future, you just do only what you need now.