Several of our lead developers have pursuaded management to assign a junior developer to document their code for them.
Their arguments are:
- You'll have two programmers familiar with everything.
- It's pair-programming, kinda.
- It's more cost-effective = they will get more done.
- It demonstrates that their code is readable and maintainable.
- They'll be happy to answer any questions; so it's a form of mentoring.
However, the number of programmers they keep busy in order to stay current seems to increase over time.
Is this a good idea?
Wow! This is so not our experience!
Here are some clarifications that turn out to be important.
The senior developers are reflexive self-documenters. It's a core hiring question. They sometimes need to be told "leave this for the junior guy".
This is veiwed as a validation tool for the senior guy (and our junior guys are hired with I think pretty high bar to clear).
Yes, code should be single-purpose and self-documenting. If the junior guy can't comment it easily, it's feedback the seniors take seriously.
The juniors are expected to treat it as a refactoring exercise, and it works that way more often than you might expect. Especially catching stuff like YAGNI issues, excessive scope, etc. They get to put their seniors into the crosshairs. In fact, they originated the change. (If they really start objecting, we'll back it out. The seniors are more than willing to adjust - they understand that they more than anyone else are responsible for juniors succeeding.)
Don't your senior people want to explain their code?
We have a strong commitment to the Agile principle "everyone owns the code". We think this accelerates the process.
Finally, a personal note - when I'm trying to understand someone else's code, the first thing I want to do is re-comment it as I try to understand it. Why is commenting viewed as so onerous?
Maybe we filter out some junior applicants because we make it clear this is how we work. But it's not a turnover issue. (But it's only been 3 months.)