4 ms·
> Let computers do the boring parts It's hard to overstate the positive changes having good test coverage can make on your code reviews. You get to switch from
by dahart 9y ago
> Let computers do the boring parts
It's hard to overstate the positive changes having good test coverage can make on your code reviews. You get to switch from discussing potential mistakes to discussing strategy, almost wholesale.
> Never say "you"
Do use "you" when complimenting someone. Think twice when critiquing them.
There was a fabulous article that passed HN once on how to communicate with optimism. https://news.ycombinator.com/item?id=12298898 https://news.ycombinator.com/item?id=12298898
The main point I took away from it was to use specific, personal and permanent language when complimenting someone. Use general, impersonal, and temporary language when criticizing someone. Positives are things people get personal credit for, negatives are forgivable temporary behaviors that can change and everyone is prone to.
> Tie notes to principles, not opinions
Like most programmers, I automatically enjoy discussing principles. But, most often principles are opinions. I try to keep them out code reviews when I can (which is perhaps the majority of the time, but definitely not always). I like to focus solely on what works and what needs to be done, if I can. Being too "principled", in my experience, often leads to not looking for, and not understanding situation specific reasons to go against a given principle, or to prioritize one principle over another. Plus, almost everyone is applying their principles when they code, it's just frequently not the same principles you think of when you review the code.
- jschwartzi 9y agoYeah, I've been asked to make an implementation worse before because it didn't look like the reviewer's code. I used a static pure function to implement some basic functionality and made that function public so that it could be unit tested. The reviewer asked me to make the pure function impure and protected and then use the friend keyword to couple the class to the unit tests. When I asked him about it all of his responses were on the principle that we shouldn't use too many techniques from the language, and we're already using friend to do what I was doing with the static function. Needless to say since this was a favor for the reviewer and his feedback was basically "completely reimplement the solution for a totally arbitrary reason," the pull request languishes to this day.
- KKKKkkkk1 9y agoIt's nice to have the luxury to have a PR languish because of obdurate code reviewers.
- throwanem 9y agoI mean you could just explain why you're not going to do that, and if he still refuses to sign off because of it, find another reviewer or escalate or both. I agree that it's no good having a reviewer with bad priorities hang you up over them. But you're the one whose task it is to carry through if you can, and parsing blame doesn't ship code.
- matwood 9y agoIf I'm reading this right, it sounds like the reviewer was arguing for consistency with the rest of the code base. If so, I can agree with the reviewer but I would have added that if the static function was superior how much work would it be to make them all consistent.
- jschwartzi 9y agoIt would've required completely rewriting the solution. The reason we used friend functions in the past was when we had god objects that we needed to test. It did not make any sense here since the class under test had a single responsibility. It would also have made the implementation more complicated and would have tightly coupled the unit tests to the implementation of the class.
- dahart 9y agoBeing a programmer, it's extremely likely that @jschwartzi was already trying to be consistent in every way he knew how, and every way that mattered to him. Bringing up a random and surprise way to make something consistent in a code review, for reasons not already written down and agreed upon in your team's coding standard, should generally be deemed inappropriate. I recommend codifying the axes of consistency in your org's coding standard and style guide -- that's what they are, after all. Make sure everyone agrees. If a new consistency rule seems important after multiple similar PRs, it should go through a process where the whole team discusses whether it should be adopted into the style guide. In my experience, "consistency" is one of those abused opinion-principles. Everyone has a different idea of what it means to be consistent. Some consistency is a great idea, but in general, appeals to consistency that aren't already in the coding standard should be prioritized lower than simplicity, and lower than whether the code & tests work as designed.
- eradicatethots 9y agoDoes strategic speaking make any sense when you’ve both read these guides (the answer is no). I don’t think it’s normal to need a guide on how to communicate with people, and I don’t think a guide can help you if you feel like you need one.
- dahart 9y agoI don't understand your point, can you elaborate?
- eradicatethots 9y agoIf I know you’re trying to manipulate me with some speaking strategy, it looks bad for you and fails
- dahart 9y agoMan... wild. I sincerely have no idea what is bugging you, whether it was something I said or something in one of these articles. I'm honestly interested to hear why you're responding this way. I am open to a point of view that contradicts mine. I'm wrong about things as often as anyone. But it feels like you might have misunderstood something along the way and taken it personally? I don't know, feel free to clarify, if you want to discuss this. If you don't want to discuss this, how about we just stop and let it be? It sounded like you thought the code reviews article at the top of this thread, and the optimism article that I linked were contradicting each other? Is that what you meant by strategic speaking not making sense after reading both of these articles? As far as guides on how to communicate, I'm not sure what you mean about it not being normal. I can't even count how many best-selling books on communication there have been. Learning how to manage programmers is largely about how to communicate. Learning how to be a better programmer is as much about learning how to communicate with your manager and team mates as it is about learning programming language features. I spent 20 years in school learning about ways to communicate. I've since spent 20 years coding for corporations of various sizes, and all of them have had both mandatory and elective classes on communication. Learning communication styles & pitfalls seems absolutely normal to me. In my opinion, breakdowns in communication are the single largest problem in software development, and probably the single largest problem with the human race. I'd speculate that someone who thinks learning how to better communicate won't help them at all is most likely unaware of history and also frequently failing to communicate effectively.