r/coding • • Aug 22 '17

You're using git wrong

https://dpc.pw/blog/2017/08/youre-using-git-wrong/
30 Upvotes

71 comments sorted by

View all comments

58

u/ReginaldDouchely Aug 23 '17

Have you ever did a code review, and gave feedback that was longer than doing the fix yourself, while you’re at it?

Yeah. It's called being the most senior member of the team, and it's worth the learning opportunity.

-5

u/dpc_pw Aug 23 '17

I think you've missed the point. The problem is not being able to fix the code inline in Gerrit/Phabricator/Github code review UI, and having to describe required changes in a human language instead, then waiting for the author to implement them, and then having to double check if they were implemented like you wanted.

18

u/recycled_ideas Aug 23 '17

Which is intentional.

The point of a review is to transfer knowledge.

Yes, explaining to someone else how to fix the code is hard, but it's the entire point of the process.

-3

u/dpc_pw Aug 23 '17

The transfer of knowledge is very valuable. But very often the actual fix is a better explanation, than the description. To give a succinct example:

This method should be private.

is much longer to write and read than looking at the diff that is making the function private.

Or:

Here I have quickly changed your code to use an utility class Foo. Please use it next time.

is better than (obviously exaggerated):

Please use `Foo` utility class that you've never seen before. You might find some examples in a file `src/java/ourorg/module /submoduley/foo.java`, though it can be a little bit tricky. Just figure it all out. There's no documentation on how to use it yet. If you have troubles, good luck catching me between my meetings this week, LOL.

14

u/recycled_ideas Aug 23 '17

Yes it's shorter, but that's mostly because your code review comments are shit.

Why should the method be private?

How do they use utility class Foo and why should they use it.

In your solution the person asking you to review doesn't learn anything, so they don't stop making mistakes. Maybe they didn't use Foo because the documentation on how to use Foo or even that Foo exists is crap.

Them making the change is the whole point. It's not broken, it's supposed to work that way.

7

u/tonnynerd Aug 23 '17

It seems like you're assuming that the code review tool is the only communication channel. I don't know if there's any companies that do this, but where I work, the code review comments are supposed to be short pointers towards fixing the issues. If the author of the patch can figure it out on his own, great. If not, there's chat, email, and video conference channels that he can use to reach me. The author of the patch is not required to figure everything out from the comments. It's good if he can, but it's expected that extra communication will be needed.

2

u/millenix Aug 23 '17

In my organization, we kinda encourage people to keep as much of their communication as possible in 'structured' media, connected directly to the issue or code in question. This makes it much more readily retrievable by others who need to understand it later, and traceable to people who need to understand it while it's still in flight.

1

u/tonnynerd Aug 23 '17

I see your point. I guess it's a bit of a trade off, and depends on tools too. We use Gerrit, which sucks at pretty much everything. If we had a somewhat better code review tool, I could see how keeping more of the discussion there would be helpful.

In any case, we often have private discussions and then the reviewer posts a sort of summary of it in the review, to kind of document it.

1

u/millenix Aug 23 '17

We use Gerrit too. It sucks, but the alternatives all seem to be worse for us in one fashion or another. And even if something better were readily available, it would have to be enough better to warrant the transition cost of at least our ongoing work.

1

u/millenix Aug 23 '17

We use Gerrit too. It sucks, but the alternatives all seem to be worse for us in one fashion or another. And even if something better were readily available, it would have to be enough better to warrant the transition cost of at least our ongoing work.

6

u/Ansjh Aug 23 '17

Your exaggeration covers a bunch of different unrelated issues. Why not just say this, for example:

Please use the utility class Foo here, otherwise you're duplicating code.

Additionally, link to documentation as well. (If that doesn't exist, that's a different unrelated problem, and even in that case you could just link to the file/line of the class itself.)

6

u/cybernd Aug 23 '17

So your point is, that you are in favor of commit ping-pong over one developer having the responsibility of fixing his own mess?