News for hackers. Stuff that matters.
Re:The mortifying ordeal of pairing all day by Agentlien on Monday May 10, 2021 @11:12AM (#27106801)
Shallow and too late criticism sounds like a problem with how the reviews are handled.

At my previous job reviews were required before you were allowed to check in, meaning if it wasn't good enough you had to rework it. This meant junior engineers were quickly brought up to speed with code convention and best practices. If you didn't adhere to them your code wasn't approved.

I also found it a great way to catch subtle bugs or difficult to follow logic. But it does require actually having and taking the time to carefully review things, rather than giving them a passing glance.

Re:The mortifying ordeal of pairing all day by kstenerud on Monday May 10, 2021 @11:23AM (#27106997)
Another helpful technique to good code reviews is to keep individual PRs small. Once a PR is over a few hundred lines, my eyes start to glaze over and by the end I'm just skimming.

I've had great success with breaking larger changes into smaller PRs that get code-review-merged into an integration branch. Then the integration branch gets merged to your main branch once everything's done and verified.

Re:The mortifying ordeal of pairing all day by Agentlien on Monday May 10, 2021 @11:50AM (#27107387)
Yes, I also have great experiences with this type of approach.
Re:The mortifying ordeal of pairing all day by MockObject on Monday May 10, 2021 @11:18AM (#27106887)
Logically, any review criticism is too late, because the code was already written! Catching the issue before commitment is great, but the proper time for the feedback was during the actual writing. Now the code must be sent back for rewriting, and time has been wasted.
Re:The mortifying ordeal of pairing all day by Agentlien on Monday May 10, 2021 @11:34AM (#27107178)
Catching problems before things are written is definitely better and that's why it's often a good idea to mention how you intend to approach problems in your daily sync. If someone has concerns, they can bring it up.

But if that fails, it is definitely better to review and catch it after the code is written than to submit badly written code out of fear of wasted effort. In my experience the vast majority of tasks are easily addressed by a single person and most proficient programmers will usually produce perfectly adequate code which doesn't raise any concerns. Having reviews to catch the odd lapse in judgement or logical misstep doesn't usually add a lot of overhead (as opposed to allocating two programmers to every menial task) but saves a lot more time and effort in avoided bugs and issues than the cost of having to rewrite something every now and then.

Additionally, any single submit should be kept to a manageable size so that they're easier to review and issues are caught early. The only times I can remember having insisted someone rewrite something non-trivial have been when they misunderstood some fundamental issue, did not communicate progress as they should have, and did not follow guidelines of solving a single task per submit. That type of behaviour is in itself a pattern which needs to be addressed.

Re:The mortifying ordeal of pairing all day by MockObject on Monday May 10, 2021 @11:49AM (#27107366)
> But if that fails, it is definitely better to review and catch it after the code is written than to submit badly written code out of fear of wasted effort.

Yes, without a doubt.

> Having reviews to catch the odd lapse in judgement or logical misstep doesn't usually add a lot of overhead (as opposed to allocating two programmers to every menial task)

Having paired for years, and soloed for years, I have found that the downsides of allocation are overridden by the benefits of pairing, one of which is real-time code review.

Re:The mortifying ordeal of pairing all day by Agentlien on Monday May 10, 2021 @12:02PM (#27107520)
I have done some pair programming. At my first job we sometimes did it when some problem proved especially tricky. Typically a tricky bug.

In some cases it's invaluable, absolutely. I just don't think that's a large percentage of the code written on a daily basis. For most tasks pairing seems to be either

1) one person tapping out simple code which practically writes itself while the other lazily nods along.

2) One person solving something tricky which happens to be their area of expertise while the other stares blankly. Maybe at that point it would be useful to explain things in detail, but that can make development take much longer and if something like this requires rethinking halfway it can be quite taxing. In that case, I would prefer waiting until it's done and compiling the result as an annotated review. Which can be a great forum for asking questions.

Re:The mortifying ordeal of pairing all day by MockObject on Monday May 10, 2021 @12:22PM (#27107754)
When I've seen it adopted, it was in the context of XP. The red-green-refactor cycle affords a decent flow for pairs, who may switch off between test writing and feature writing. I can see that without the other XP practices, pairing may be awkward.
Re:The mortifying ordeal of pairing all day by kstenerud on Monday May 10, 2021 @11:31AM (#27107139)
If the code requires such a substantial rewrite after review, that would be indicative of serious communication problems on the team. In 20-odd years of reviewing code, I can't think of many instances where a review led to a substantial rewrite.
Re:The mortifying ordeal of pairing all day by MockObject on Monday May 10, 2021 @11:38AM (#27107222)
I don't know what "substantial" means but, say, in a 3 day long ticket, surely all sorts of issues found in review can easily force another day or so of work.
Re:The mortifying ordeal of pairing all day by kstenerud on Monday May 10, 2021 @12:00PM (#27107503)
Anything over half a day would be substantial, but really I'd consider any post code review fix that takes longer than an hour to be a red flag that we're not communicating effectively.

As I alluded to earlier, I've never encountered these sorts of problems in the healthy companies I've worked at (but I HAVE encountered them at unhealthy companies).