I really can't relate at all. I feel the opposite. I often feel angry (I realize this is not a GOOD response either!) and always feel sad. I don't want to have to do more work. I don't want a reminder that my previous feedback didn't click with them.
I'm constantly looking for ways to do less tedious work, through automation and such, and code review for bad code is the worst sort of tedious work. I want to learn things, but code reviewing bad code doesn't teach me anything - I want to work with people who can teach me things when they review my code just as often as the reverse.
My takeaway from that has been to try to intercept people earlier in the planning and designing and start-of-coding process. If a bunch of bad code gets to code review, someone failed at explaining what this thing needed to do and how it should be done beforehand. The article claims this is always just itself a confrontational form of argument, but... it doesn't have to be. Stop being an asshole, and find non-assholes to work with.
These people don’t last long and I have gotten pretty good at screening out this personality in interviews after having it cause huge issues at two different places I worked.
I'll say things like, "I would have done that like this because of this reason, but as long as it works"
or "This needs to change right now because it's a security hole"
or "We should find a more efficient way to do this, because as the data fills up, the users will start to notice it"
I am definitely harder on new people, and people who ask me for help when they should have been able to figure it out on their own.
As a rule, so far throughout my 5 year career as a full stack web developer, my coworkers have neither understood or cared about what clean code entails.
I don't berate, I don't criticize, I've taken to mentioning it once and then doing my utmost to never mention it again in an attempt to avoid labeling myself as the odd one out.
Granted, I've turned down a handful of much higher paying (and presumably higher quality teams) for various reasons. At first, it was because I was a bootcamper and high paying jobs are difficult to pick up out of the gate without the appropriate piece of paper. Since then, I've worked for various organizations on a consulting basis, and most recently landed at an early stage YC startup. Pay isn't great, but I have aspirations to start my own startup, so I'm cool with the pay cut for now in return for the opportunity to learn the ropes, business wise. Founder knows what he's doing at least.
But the devs, man. They just don't care. 500-1500 line React function components are the norm. No standardized way for retrieving data from the back-end. I dread assignments that require me to modify or otherwise integrate with previously written code, because the best way I can come up with to figure out what the fuck is going on is to rewrite it sanely. I'm being a little hyperbolic, I do my best to avoid rewriting wherever possible, but I'm not mis-characterizing things by much.
It's honestly depressing, especially considering I've had multiple other teams offer triple what I'm making right now, but neither of them were pre-seed startup SAAS companies which this one is, so here I stay for the time being.
Invariably, I garner a reputation as "that guy" on any team I work on, although granted this is only the second multi-dev team I've ever worked on. Still though, it feels terrible to get a bad reputation for writing good code. Founder likes my work ethic and output though, so I guess I've got that going for me.
Apologies if this turned into a bit of a rant, it just started pouring out, ha!
Well, now everyone is curious for more details on this. Do share :)
The truth is that people's emotions can be a lot more different from yours than people may be willing to imagine.
No one is perfect. But not everyone derives 'insane pleasure' from criticizing, either. And if you do, that may not be obvious.
I agree with the 'stop being an asshole' line, but to do that we need to help people realize when their qualia is way out of the ordinary. If you think everyone else is power-tripping, too, then will you think you're really being an asshole, or are you just doing what everyone else does?
It's scary to think that you might have something else you think everyone else does, but is really just you accidentally being oblivious. Speaking for myself, I'm going to try to be more mindful of this trap in the future.
I think the process of realizing he needs to do that and doing it is what he's describing in his article. Generally people don't open up about how their behavior is toxic unless they recognize it as a problem. And, though my experience with Russian culture is limited, I understand that competitiveness and criticism is the rule, at least in the STEM fields there. So this guy has been behaving the same way (most) everyone else does, but now he's realizing it's bad and trying to fix himself. I don't think he deserves the criticism he's getting in the comments here. We all start somewhere, and trying to improve should always be encouraged.
Those folks often get undue criticism, especially if they choose to speak up in hopes of fostering positive change in others.
Another thing that I think helps, at the CR stage, is asking after their thoughts for putting the thing together the way that they did. This DOES run into the potential problem of showing that they didn't put thought into it (or that part of it), but....
...there's a certain extent to which it's not your fault if they get to the CR and get a tough review. It's your organization's, "a month of work saves an hour of planning"-style. The developer who wrote the code getting the tough review wasn't set up to succeed, and IMHO that's more a comment on your org than any of the developers involved.
To bring it back around to your personal process, my (unsolicited, haha) advice is that if you're finding yourself giving a tough review, switch to a 1:1 review / pair programming session. Async text communication is hard and prone to miscommunication.
I feel, in order: disappointment - because how could they make this stupid mistake, then anger - why the f do I have to waste time to correct stupid mistakes, then a bit hateful - we need to fire this person and hire someone competent, then sometimes a bit scared - what else has this person got wrong and I missed, then a mix of all of the above.
What would make me feel good, as far as reviews go, would be to say "hey, this person did this way better than I would have".
Can you tell I hate doing reviews?
I mean maybe you're working on extremely repetitive code, but the idea that you don't learn anything from reviewing bad code, and hopefully writing comments designed to help not humiliate, seems pretty bad to me also...
You want to learn from others who review your code, but become angry when you have to teach those whose code you review? That seems bad...
I try to avoid letting this show, but it's frustrating.
People often got annoyed, they would say their PR isn’t ready yet.
That’s fair, I kind of understand, my intention was to just save them time going down an incorrect path though, because I know it’s going to be difficult to convince them later they need to rework days of work.
Not sure what the solution is.
You could do the first step for example. Put up your own stuff for early on RFC. Invite them to work collaboratively on it with you and give early feedback and see how you react. Basically: be the role model and let them follow.
Not guaranteed to work but it's one way to start some of it.
Sidenote: most teams don't actually do team work. It's a bunch of people thrown together that work on more or less loosely related stuff but everyone is out for themselves. It's a matter of the environment they have to work in in most cases. Individual metrics driven productivity culture. You can't expect someone to do good team work and collaboratively come up with the best approach when their incentives from management's side is to get as many PRs merged as they can to get that bonus and a good end year rating etc.
When one company buys another the quality of the code is a calculation in the sales price. But it's a small one, and it takes a real dumpster fire to move that needle.
What kind of automation or tools are you using for code review?
That emotional reaction in combination with conviction everyone has the same one disqualify him.
Some might say, oh it's hazing, well fuck you because I'm quitting. I'm not putting up with any amount of hazing at a job. If I have to spend 8 hours everyday somewhere I'm for sure not going to spend it with some asshole.
This person is so confident in himself, that he thinks his code review takedowns are so brutal, yet effective, that he is ruining lives. It almost comes off as "I'm so handsome that I ruin people's lives with my looks and I'm sorry."
And then there is this...
"I was mad that, while I spent my nights learning F#, my daughter started calling everyone around “fathers”. And this guy, instead of getting better at his job, went home to his children. And I wanted to punish him."
Uh, whose life is being ruined?
The recounting of "bullying"/hazing on forums definitely resonates as well, and he's just remarking that he'd become what he'd hated.
This is more of a reflective piece rather than a glorification of his behavior.
>> My personality today isn’t my disease. It’s a disease of the whole industry... just stop being that. It’s quite easy, actually.
I’m craving some constructive feedback.
Instead of "please write this code, submit a pull request, and I'll tell you what you did wrong," I have recently been saying to new coders "take a shot at this problem, and when you've got something working let's get together and refine it, there is some context it will take time to learn so we'll probably need to make a lot of changes or even rewrite it before release."
That way they know what's coming (a lot of changes), they know why it isn't a sign they're inadequate, and it's more about working together than passing judgment.
It has also helped reduce the massive delays while junior developers agonize over making something perfect.
I've been on the receiving end of enough toxic code reviews to develop an aversion to do them. So when asked to do them, I really just ask, did you test it?, do you want to demo it to me?, then approve it.
When people demo to me, I can see their pain points, because they always point them out. "Oh yeah, I was having trouble getting this to work, as you can see, it's still a little slow" and it gives them an opportunity to ask for advice or merely to vent.
So if you want good, honest feedback, a demo is the way to go. Honestly, it's hard to really grok what a bit of code is doing just by reading it. And who has time to pull code and run through it solo when doing a review?
(It might also mean your team doesn't care about anything any more, in which case look for a better opportunity, unless you want to just cruise along for a while for whatever reason, in which case turn into a bare minimum performer like the rest of your team).
I'm a senior engineer in a known company and my target is always to leave no comments on a patch. I only give question-comments if I absolutely must know something before merging, or please-fix comments if something is definitely wrong and I can prove it. Also, if it's a part of the system that poses little risk (for example, if it breaks I can assign the bug back to the author and patiently wait for a fix with no serious damage) my tolerance for bugs greatly increases. The last part I'm not too proud of but frankly I don't have time to review everything. A "fix" for the last part would be to find a lower rank reviewer-buddy who has more time to share knowledge.
It’s better when code reviews are suggestions, the reviewer doesn’t nitpick (or at least fixes that stuff themselves), and small things like formatting are enforced by a linter.
My mental model is that some people feel like they must comment on a code review to show that they've done something. They don't actually care, but just want to write a comment or two and you can shrug those off.
If following this approach you do need to be careful to only ignore genuinely useless comments though. Often a good way to tell is just to chat with the reviewer. That has the added benefit of the reviewer learning that useless comments will create more for them because you'll be by to chat about their useless comments.
In other words, I think it's correct to not consider every comment to require a change unless it really needs it, but that doesn't mean a comment that doesn't require a change for the current work should necessarily be ignored because of that.
* in my experience, of course.
I've had the same thing the other way, where I feel that I usually give kind and fair code reviews (no nitpicking, etc) but have had former colleagues that get genuinely upset and push back really hard when I make any sort of comment on their PR.
In my opinion the first priority of code review should be to prevent mistakes in the code at hand
I disagree. The first priority of code review is WHAT problem is it trying to solve and does it actually solve the problem.
If it's not even solving the problem correctly, pedantic nitpicks are inconsequential.
Because it creates technical debt, that's why people get frustrated with shit code. They just aren't properly equipped how to convey/teach/train/fix it without coming across like an asshole.
Does it ? Sometimes, the code reviewer has taken less time to analyze the problem and has not seen all problems a simpler solutions would bring.
The real danger of confusing the two is that real skill dulls if you let overconfidence take over, since the very thought of being "better than others" prevents you from accepting that maybe there are things that you don't know or haven't considered.
For example, is "destroying" a coworker's commit in a code review really really helping? Did the person perhaps forget to consider that hiring to refill the position of a fired developer actually costs physical money (as opposed to time spent on coaching?) or that perhaps a lot of time is being spent on nitpicks without bottom-line value or that tip-toeing around egomaniacs can stunt autonomy and therefore creativity? This is not merely a matter of whether you're lulling yourself into some false sense of superiority/duty/whatever; thinking in terms of bigger and bigger pictures is an actual skill that one needs to develop when going up the career ladder.
Why should be bad PRs ever be allowed for any reason?
What really matters is whether the code is solid and whether it will actually cause problems. Just because a PR isn't character-for-character how I'd write it doesn't mean it's bad. Based on the author's experience with the fired employee's replacement being just as bad, my guess is he was over defining goodness and raising the bar too high.
Bad PR to me means: bad runtime complexity, bad formatting, bad security, bad memory use, bad understandability. If it meets all those bars, which for a crud app is usually easy, then it should probably pass. I'll sometimes leave a "I would have done _x_ differently" comment on matters of taste _if I think it will help the other developer_.
hell, that's a GREAT opportunity to get this "bad developer" under your umbrella and start mentoring him to be a better developer.
It's first solved by identifying what the cause is of their poor performance. Are they in over their head? Are they having personal problems which are distracting them? Are they experiencing burnout?
I've heard people say that they enjoy code reviews because it gives them latitude to be ruthless. After all, it's for the benefit of the business to not allow suboptimal code through, and it's just code. But frankly, I think that's a lame excuse and the easy way out.
There are people behind code, and while the code might suck, the people don't. Obviously, that doesn't mean you should let it through, but it does mean you should be at least professional, and preferably compassionate in how you review it.
Ranging from "I wouldn't have implemented it that way" to "this opens up a huge security hole".
Security issues shouldn't be allowed in. But a lot of "maintainability" issues have negligible if any gains, and real costs like
it takes time to fix
could introduce new bugs
creates bad feelings between coworkers
Define bad PR. Are you sure that your definition of "bad" is accurate?
So I read or saw multiple articles in Russian from this specific author. Actually, the one linked in this post is a translation. To put it bluntly, while they clearly have a background in software engineering, they are a troll. All their articles seem to have one thing in common: they look to be as controversial as possible on purpose, I don't believe them to be sincere.
And I'll give it to the author, the tactic worked great: their articles usually generated a huge discussion in comments and -- I would guess -- a lot of traffic for the site. Though people seem to got immune to it over time.
And there's probably nothing wrong with writing in a provocative style, but you might want to keep it in mind when reading the post and not take it too literally.
Is "don't be an asshole when it's actually not helping the other person like you told yourself if you look closely" actually controversial enough on that site to be considered a troll?
Honestly, the article comes across to me as someone publicly acknowledging their shortcomings in an attempt to combat them. If that's trolling Russian developers that frequent that site... maybe they deserve to be trolled in that way?
In Russia, yes. Like the OP comment author, I'm familiar with both IT cultures, and there's a dramatic differences in the amount of politeness.
I have actually seen people get into a physical fight because of work-related dispute, more than once.
A code review is an opportunity for the reviewer to learn about someone else’s coding style and improve it when necessary, and the reviewee to learn their flaws and just how other people see their code. Because everyone has their own viewpoint with their own flaws. Not an opportunity for the code reviewer to show that he’s smarter, or the reviewee to be “humiliated” that his code isn’t perfect.
I had precisely one boss who was an asshole code reviewer - and the worst is that by then I was a far better programmer than he was, because he was crazy.
(Random example of many - he personally adopted a "foveal coding style" which meant that he pressed return at the first possible moment after 40 characters. Yes, 40. To achieve that, he had a whole glossary of local variable names, all starting with the same prefix, that you needed to learn to read his code - slea, sleb, slec, sled, slee, slef, etc. "sle" stood for serialized ledger entry, except that none of these were serialized and most weren't ledger entries...)
Even knowing he was an idiot, these abusive code reviews were surprisingly hard on me, particularly since I got forced to do a lot of stupid things with my name on it.
I started to get panic attacks, and they lasted for years.
I made a girl cry once with a code review when I was being purely formal - "this cannot work", that sort of thing. Maybe she was somewhat oversensitive, _but_ she was definitely overwhelmed by her new job, and it was not productive! It was just a mistake on my part.
So I am "brutal" and incredibly detailed in code reviews _but_ I'm also friendly and chatty and explain how I have also made that error in the past, which I certainly have because I have made a huge number of errors!, and tips on how to avoid these issues in the future, as well as some sort of programming language suggestion if appropriate.
People seem to really like it. I get a lot of kind words. It makes it much more fun if you see this as a collaborative game whose idea is to get the highest group scope than a competition.
(Also, it's the rare code review that I don't catch some actual bug in the code that would lead to wrong results, and if you point it out nicely, people really appreciate not having to debug that later.)
https://medium.com/@sandya.sankarram/unlearning-toxic-behavi...
I've found that I usually start with the "correct" way and end up regressing to the "wrong" way as more and more work piles up, stress builds and deadlines approach. I guess the "correct" way only works if the organization actually prioritizes it and gives reviewers the time to do it the "correct" way no matter what stage the project is in.
https://mobile.twitter.com/sebjilke/status/10364067943591731...
(I believe TFA is Russian, so read the Eastern European graph)
Hilariously, the first graph is titled "Objective distribution" (of criticism phrasing). That's not how language works...
Yay! you found an edge case that breaks a piece of code that will never get hit while the other million and 1 edge cases that haven't been found are still out there. Yet you drag it out from the dark and show it off for all to see like some damn trophy. Yay! look I am great I found one more thing wrong than the other guy. No matter that we are all swimming in a sea of wrong and every one is completely clueless. Only slightly less clueless than those who don't even realise they don't have a clue.
It follows from a simple argument - every programmer and every company has a different view of 'good'. I've seen it, I've worked in many. Just as every religion cannot be right, every weird view on correct programming style cannot be correct.
Code can be like that, too. You write code, and it's enough to convince you that it does what you think it does. But someone else reading it can sometimes see the holes that you don't see.
Assuming that person X writes bug-free code is bad, whether X is "you", "me", or "that co-worker".
I don't have to be better than the PR author. I just have to be decently good, and be a different person. That's enough.
And of course I'm looking for bugs. That's the absolute first thing to look for!
Now, true, if I can help the author be able to see their own bugs (asking questions, maybe), then that's probably better than me just lecturing them. Teach them how to think so that they can see it themselves next time.
When the DI is screaming profanities at recruits, [s]he is preemptively saving their lives. The manner in which it is done, is actually a component of the training. A significant part of military training, is to deprecate the individual, in favor of the team. The DI is not an individual. They are the sharp end of the elite organization that the recruit hopes to join. The variable is the recruit. The organization is a hardcoded constant.
But most of the world is not in the military.
I understand Linus' expletive-laden rants. I don't like them, and I think he could probably find other ways to enforce Quality, but he does get results. The same for Steve Jobs, and his infamous diatribes. When I worked for a Japanese company, I watched managers literally bring employees to tears, with simple, quiet comments. I worked for a British company, and got experience with the sarcasm-fueled way that British managers work.
As a manager, I worked with firm kindness. I made it clear what was expected as an end result, and did my best to support my employees. It seemed to work for my team, but I also had a particular type of team. My style probably would not have worked in other contexts. I feel that I projected a gestalt, as opposed to a set of individual orders. We acted as a unit; which wasn't easy, as I also worked to preserve the individuality of the members.
As a coder, I am fairly obsessive about Quality. Code quality, documentation quality, design quality, process quality, schedule quality, and end-result quality.
I'm very hard on myself. I set a high bar, and usually meet it.
I've learned not to project it onto others; if at all possible. I understand that my level of Quality is probably not something most companies would consider "cost-effective."
Here's an example: I am writing an app with a screen that displays a big map, and has overlaid views and controls. I spent at least 45 minutes, today, ensuring that one of the controls aligns pixel-perfect with its "alter ego" in the "unfurled" HUD display. It was a pain. I had to set a measurement point in the simulator, run the animation, then review the open display, and make sure they matched. Then, I had to rotate the device, and do the same.
Many, many developers would say "5 or six pixels off; good enough. It's all under a fat finger, anyway." I am not right in the head, though. That kind of thing actually makes me physically uncomfortable. For me, that needs to be 0 pixels; even if it is under a fingertip.
So I will do it for my work. If I find that I can't use the work of others, I won't work with them. I'm very, very picky about dependencies. Fancy Web sites and eye-candy aren't particularly indicative of decent work. Sadly, large user communities no longer seem to be a mark of quality, either. I can't take anyone at their word. I have to test for myself. I have been fortunate to find teams of like-minded folks, but they are rare.
But I won't tear people apart, and I won't lob public insults. I feel that is not helpful. If the only way that I can feel good about myself, is to tear down others, I need to do some work on myself; maybe with a psychotherapist.
This is true but it's not simply because it breaks down individual identity and makes the team more important than personal ego. If you can't stand unflinchingly in the face of yelling and cussing, you can't stand unflinchingly in the face of live fire and people trying to kill you.
Still stand by what I wrote, but glad the OP was flagged out.
1. Critical mistakes
2. Style guide mistakes
3. Non-optimal design (in your opinion)
#1 Always receives a comment, obviously.
#2 Always receives a comment, but we have good automation here so it's not too much of a worry.
#3 Is where it gets interesting. A lot of the time, commenting about this category is prematurely optimizing and it's a waste of time for both the reviewer and the owner of the change. At most I try to make one overarching comment about the design.
You really have to ask yourself "Does it work? Will it cause issues down the line?" If the answers are Yes and No respectively, you should likely let it go.
The feeling of ownership over the design, especially for a junior engineer, is incredibly important for moral and the ability to get better over time. IMO it's also important to let them make small mistakes now and again so they can learn from it.
I don't necessarily want or expect them to change their code but I want to make sure they're considering multiple options and intentionally choosing that path instead of just copy and pasting something from stack overflow (as an example.)
I was taking a graduate-level introduction to mathematical logic. In the class we learned about a bunch of different propositional axiomatic proof systems, and then we proved properties like soundness and completeness for them. The class was organized around class participation: everyone was required to do at least one proof at the board in front of the class and every session consisted almost entirely of students doing proofs at the board.
I'd been out of school, working, for eight years before grad school and I found this all very intense and unfamiliar. I did my required work at the board, choosing an easy problem, but otherwise mostly sat in the back and watched. There was, however, a cohort of very intense aspiring logicians who sat in the front row and took deep interest in every proof.
One day, a student went up with a particularly challenging problem. From the start it was clear that he was taking an unorthodox approach to the proof. The front row went nuts, interjecting and kibitzing on practically every line, telling the guy different things that he should do instead of whatever it was that he was doing. The guy was a good sport and tried to justify everything and answer all the criticism, but it seemed like he might not get through the proof before the class ended.
The prof who had been watching quietly from the side of the class, let it go on for a while, then stepped out and quieted everyone.
"I need you to remember," he said to the front row, "that we are the audience. It is not our job to prove this theorem; it is this gentleman's job. Our job as the audience is to listen to him, and at the end, decide if we are convinced. He may do things differently that you would have done, but that doesn't matter, as long as in the end we are convinced."
That was twenty-three years ago, but it stuck with me. In programming, there are often many different ways that a problem could be solved, but there is almost never One True Way™, even though there are often many voices that would like to convince you that their way is the right one. My job as a reviewer of code, or really anything, is not to try to get the other person to do what I would have done, but to decide if I'm convinced that the way that they've chosen is good enough, and, if not, to ask for changes that would convince me.
Sure, sometimes a PR is so bad that it needs to be completely rewritten, but in my experience that's rare, and in that case the feedback should probably be given in person and in private or in a friendly, sympathetic group.
Would definitely recommend those for any teams that have a similar teammate as the article author on their team.
If you overwrite all their code, what have they learned?
I think that this is called projection.
Maybe everyone else only writes good code, but this works for me every time. Even after over 30 years coding, I still have no problem seeing how imperfect the code is that I wrote as recently as last year.
And don't ever make it personal, anyway. Adopt a neutral tone, phrase comments abstractly as how they relate to team goals, how the code might be made clearer, etc. Don't accuse, don't belittle, don't try to look smarter than you are. And try to recognize the difference between the stuff that actually matters, the things which will actually be a headache down the road, and the pointless details that are just not how you'd have chosen to code something.
Code reviews never help in those cases. There is always an underlying cause: the developer is trying to rush to prove something, or maybe over-engineering for the same reason. Maybe he has some issues at home, or isn’t sleeping well. Maybe it’s just lack of experience. Maybe it is a personality issue and the developer is trying to save face by sticking to his guns.
Either way, I find that it is much better to have private discussions with the developer to increase the code quality via mentoring, or pairing. It helps removing the defensiveness, doesn’t make them feel publicly humiliated and doesn’t spend the time of the team with the review-fix cycle.
And some of the code produced by both data scientists and engineers ... it's, hm, not great? Just between you and me? So I'm glad I've never had the inclination to tear anyone to shreds. Indeed, part of my job used to be to help people with their coding problems, and I loved doing that.
But sometimes when I'm reviewing code ... it's very hard to bite my lip and not call out every little issue, even though it would just be too much and most of the "problems" aren't actually very important. I try to impress upon people that developing good code is useful when I lead training sessions, but it's hard, especially for people who'd rather be doing data science than coding.
I do think thorough feedback is important, that's how I've learned the most after all. But typically now if I I'm going to write more than 5 comments, I meet with the other developer in person instead. That way the code problems are solved faster and it avoids any sort of public humiliation.
That's way too much feedback. It makes it very hard determine which problems are critical, and which come down to aesthetics or personal preference. On the flip side, if I was churning out buggy code at that rate, I'd want to know about those bugs in detail.
There's also an opportunity cost of evaluating code so tightly. Not only does it take up more of the reviewer's time, it also eats up developer time that could be spent on other features.
> The reason for these angry code reviews is obvious. As part of the team, I bear full responsibility for the project’s code base. I have to work with it later, after all. It’s a source of many issues for the business. The code doesn’t scale, can’t be tested properly, is littered with bugs. Support gets more and more expensive. It can’t be open-sourced or used to lure new developers.
Premature optimization? The mistake here is trying to optimize the legacy of your code base, possibly thinking too far ahead.
PRs are conversations. Every team member should be able to request changes to start a conversation. A conversation about the code should focus on what tradeoffs are necessary to get stuff done now along with a consideration of how comfortable every team members feels they can maintain the code.
Teams where PR approvals are considered endorsements, where PRs are rubber stamped, where developers throw fits when others dare to ask questions etc are detrimental to both getting things done and maintaining a sane working environment.
Don't confuse the code with your worth. The greatest asset you will ever have is the ability to be openly critical about code you have written while understanding the right level of imperfection for a given circumstance. This only comes with experience. The more you nurture your ability to view your own code critically, the faster it comes.
Since we all have blind spots, take others' questions seriously.
- is a developer making the same set of mistakes? send them information on a better strategy to try overall
- how bad is this mistake? Is it just something that I know how to do better, or legitimately a broken way of thinking?
- what is worse, a slightly inefficient or unpretty algorithm, OR someone researching the problem / solution
Point is, 90% of my comments were meaningless. I really comment when things look wrong -- Did they misunderstand the intent of the ticket, did they verify everything with product because this looks weird, did they check the edge cases, did they forget about this other behavior, etc. All that I just mentioned is the real meat-and-potatoes. Code-fu is important, but less important than the other stuff. And if you are a calm, trusted, and mentoring team member, those same people will come to you to up their code-fu voluntarily.
The only I things I manually look for in reviews are overall readability, sensible naming, high level adherence to the architecture/design, and data system/database/API queries.
After 20 years of writing code and leading teams, I've found that most of the stuff developer blogs and the OOP community fret over simply doesn't matter in most cases. The high level interfaces are often more important than the low levels details, and static code analyzers do a decent job of pointing to problems. I've almost never seen bad code that didn't also have many issues in the static analyzer.
It also matters what kind of code you are writing - foundation code or something that will be used by thousands/millions of developers should have a higher bar than some internal one off. However, I've seen enough very profitable companies running on total crap code to believe that code quality is the most important thing.
His post reminds me a bit of this religious group, Filhos da Mente de Cristo, that appears in Orson Scott Card's novel Speaker for the Dead. All members of this group take names that reflect their resolve to overcome their greatest flaw, for example: "I will put others before myself" or "I will listen carefully before speaking", etc.
An important skill to develop is the ability to "read the audience". Almost prescient in nature, predicting how people will react to you is of utmost importance so that you can tailor your responses accordingly.
This is important when mentoring people because, even though tough love might work on some, it may very well destroy self esteem for others and make them shift career, ending something before it even starts.
If you are in a position of mentoring, it is your responsibility to adapt. It is painful, frustrating and a source of contempt when you try and try but you just can't seem to find the sweet spot to inspire newcomers, but as long as you persevere there is hope in teaching others.
I had a recent experience in this. I am in no way a long experienced infrastructure engineer, but I built my share of cloud applications to have an idea what can go wrong. I recently tried mentoring someone new and it was just plain frustrating. I couldn't explain too much without overwhelming him with details, and I couldn't just direct to sources without him feeling abandoned. That sweet spot of attention I couldn't reach before he requested to "learn different things" and effectively abandon infrastructure haunts me sometimes.
Many times, I felt like I had to write code to get through the co-worker's code review, not for the requirement. The requirements to get pass that code review felt inconsistent and vague, so it made work very stressful. Having a conversation with him was a chore as well, as he came off to be very critical even when prepared with questions.
When he left the company, I was not the only one who felt a weight lifted off all of us. No one wanted to put up with that.
Code reviews and other analyses should be topics of open conversation, if anything. They should work both ways and help each other about not only needs but skill development. When it is used as a tool to boost someone's ego instead, it becomes counter-productive and many years later, I sometimes have that in the back of the head, even with those who I know can be attentive towards criticism in code reviews but are otherwise good people.
At one point we had a major issue with a client, because our daemons weren't installed on their hosts right before a major event of theirs, and none of the tooling could install on this clients' hosts. So I threw something together over an afternoon that could do it all by frankensteining the other devs' code. It was run-once code to fix the emergency. Lots of selenium garbage.
Since it was one-off, hacky code, I didn't feel it was necessary to put it into git, so I didn't.. until others complained to management and forced me to. From there, I had about four devs dog pile my code, commenting on everything wrong with it - maybe 20-30 comments. I explained that it was one-off code meant to solve a specific problem and of course it was going to be messy, but I got responses like "if your code was made public, you'd want your code to be clean so you can be proud of it!". It was infuriating, considering their system worked maybe 5% of the time.
I'd like to say it was in good-faith, but I really doubt it. At one point while I was there, one of the devs rejected a PR because I had bash in an Ansible role, saying "you don't know if the remote host will have bash installed."
That whole ordeal was enough to leave the company.
I always look at code reviews or just reading / talking about each other's code as a way for us to just get on the same page about how we do things. Make everyone's life easier. "Hey man when we're looping through that thing here is how we usually do it." "Ok cool, I'll do that." Or maybe we have a discussion on why I did it differently this time and how we might address that.
Much of the time I don't "care" or feel strongly what the change or answer is. If we're all doing the same thing / spot a bug sooner, it's just easier for everyone.
But it seems code reviews to some are this sort of battle / proving ground / have a lot of elements of status. I don't get that...
Or he's just lazy.
It's way harder to build up the people you work with than tear them down. The key ingredients tp the former are patience and empathy. And those qualities are lacking in many managers.
Also, aggressive, opinionated people are often perceived as more intelligent than their more reserved peers. You'd think that the snowmen can't get snowed, but the type of person the author describes seems to be just as vulnerable to the misdirection as others.
Good code reviews spot real bugs and provide solutions and explanations that help the owner to improve their branch. It's completely constructive and feels like going out of your way to way to help them and paying attention to what is meaningful -- the vibe should be a bit like "doorman at a posh hotel providing excellent service", so not disrespectful at all. Also, if you're nitpicking, it's a sign of lack of focus...
Devs often have insufficient time for the standard of perfection code reviews assume: perfect code, formatting, testing, experience, foresight, etc.
Code reviews also have a strong element of bullying, hazing, and people reenacting semi-trauma (that is the cycle of abuse so common in life: trauma makes you lonely, enacting that trauma on others in kind makes you feel less lonely)
I used to joke that in lots of enterprises, it isn't faster, cheaper better pick two, it's actually faster, cheaper, better, follow process, document. Pick about 1 1/2.
This has to either be a cultural thing or satire.
I have been mentoring junior developers for about 10 years, and some more senior ones for the last few years. My ego is more attuned to getting things done than tearing up people's work. The following works really well for me:
1. Never insult people's work, it's counter-productive. (Unless see number 9) 2. Nitpick on convention/style, not implementation, unless the implementation is infeasible. Convention and style will quickly become rote. This forces new developers to pay more attention. 3. If it works as intended and has meaningful tests, MERGE IT. Congratulate them :rocket:! 4. Point out logical pitfalls/caveats by asking "what would happen if". Asking questions starting with "why" triggers people and puts them on the defensive. That's your EQ lesson for today. 5. Through code-review, you can identify a lot of little problems and suggest articles to read that would help the person grow. Examples: misunderstanding async/await vs. thenable in JS. Parallel programming in R/Py. These are distinct, language specific (R has sessions/multicore, Py has the GIL) pieces of knowledge that people can learn easily with a tiny bit of guidance. 5. If you're a better programmer - write the first 1000 lines so that they can fill in the next 10,000 (credit: don't remember, someone tell me?) 6. Even junior developers can get a surprisingly challenging task done if you give them hints (point form) about how you might approach it. 7. Do code reviews in-person (1-1) or if you are tactful with your feedback and have encouraged an environment where making mistakes is acceptable - in a group, that way everyone learns! This is the management version of the DRY principle. 8. One of the biggest problems I see with new developers is "how do I break this problem into smaller pieces". Discuss potential approaches BEFORE the PR. Not after. 9. Fire people that are consistently lazy. When you manage people for a long time it easy to see the difference between someone that needs training and someone that is lazy. You can help a someone that wants to learn, but you can't motivate someone to be interested in something that they aren't already. 10. Cultural differences can make people less likely to speak up when they are stuck - check in with your team!
ego is one heck of a thing. this guy sounds terribly painful to work with.
i also agree with another commenter, if tearing people down gives you pleasure, you might be wise to seek counseling.
I haven't. I love it when I see a great PR that I can just stamp "Approved" on.
The last thing I want to do is close something as so bad it's unsalvageable.
https://news.ycombinator.com/item?id=19190472 - 155 comments
There are also good comments here about prioritizing the categories of issues into whether important or not.
I have been doing this work for far longer than I care to admit. My rejections/non-approvals (both received and provided) land in one of the following categories: (a) Did you notice that? (Oops, D'Oh!), (b) Did you know about that? (Educational), (c) Did you think about that? (Edge Cases), and (d) Why? I work with these men and women day-to-day, so we don't often need to butter up negative responses, we have established that "I trust you can do your job" and my comments do not imply otherwise.
The best way I've heard it said is "We do code reviews because errors in software development are common, regardless of proficiency. I don't write perfect code and having a second set of eyes on my work will only make it better/me look better. Reading a growing code-base by reviewing each other's work benefits everyone."
Of the ways those land, the (b) category is the one that requires a little care (if your goal isn't just to bully/shit on someone's gap in knowledge). I find the way to take the sting out of it is to start off with "Hey, I came across an approach to solving this using (whatever); have you done anything with that? It would be an improvement ... (comment goes on)". I didn't say I came across that approach 15 years ago, that it's what I have decided is "Kindergarten in C# School". Guess what? Someone's read my code and thought the exact same thing. I know this because I've thought them about code I've written as early as 6 months prior. Of course, it's a matter of perspective. I thought that over the one thing I saw that made my toes curl up, never mind that the rest of it was perfectly fine, just like the code I'm currently reviewing.
My favorite, though, is the occasional class/implementation that lands in "Why?". Usually those look like the previous -- a WTF-worthy implementation that the only comment I can send with is "Why was this particular implementation used?" -- and often it requires refactoring ... but every once in a while there's that gem. Some edge case that was cleverly discovered, covered and the developer was left with "This is, literally, the only way that this can be done (given the constraints)." It's the code that's both frighteningly ugly/really cool once you realize why it had to be that way.
[0] I was one of two (but really, one of one) doing the entirety of secure code review for a large multi-national telecom for one brief, terrifying, point.
Editorial: code reviews are inherently combative; if criticism doesn't come off petty, it comes off paternalistic which is worse, imo.