0

I have a co-worker who I got to know through a mutual friend before we started working for the same company, although he s been working in the company for a year more than me, he was kinda relaxed and didn't take much responsibility and doesn't have a good reputation among his seniors, I recently joined and worked hard to understand the product better from a technical standpoint and have a better hand at it now.

My colleague recently started developing a feature for the product and is almost set to completion, he now asks me to review his code before going through the formal code-review process, I can see a lot of flaws in his code already and I want him to learn, at the same time I strongly feel that I want to review his code formally just so that people know that I have helped him in coming up with a better code than what he already has, another reason is because I want him to work hard and not have everything spoon-fed to him.

Am I being too selfish here? How should I react to this ?

  • I suppose you're using git or some other version control software ? So if you're changing his code, you'll be doing changes under your name, anyone can see what is your work and what is his, no ? – MlleMei Mar 24 at 22:54
  • Yes i am using git. – Sujith Shivaprakash Mar 24 at 23:08
  • Not only you, but the whole company, right ? So if you make changes to his code, others could see your commits (contributions) to this. – MlleMei Mar 25 at 7:04
  • Also, is he asking for you to make the changes, or just some advice ? Where I work, code review = peers pointing out mistakes or improvements, and the developer fixes them, the reviewers don't change the code themselves. – MlleMei Mar 25 at 7:15
  • 1
    One important detail that would help frame the question: Just how much code and work is there here for you, that is being asked as a favour. Would a thorough review take you 1 hour, 4 hours, 2 days? – Neil Slater Mar 25 at 7:47
3

If your colleague/friend just wants some pointers on how to improve his code, than yes you're being too uptight. If he wants you to rewrite his code, than you can take the decision you want.

Code review

I would just do it. Credit for reviewing code is really not much to fuss about, and you'd be a good colleague and a good friend. Write an email or do a commit where you add comments where he can fix/improve his code. If what he wants is you rewriting his code and you don't want to, you can always suggest this. Say you don't have time to make the fixes/improvements yourself, but that you can take a bit of time to help him out like this.

Code rewrite

If I understand correctly, you'd be willing to rewrite his code if you get some credit. I understand that, although I would less worry about this, but wouldn't want helping someone misrepresent themselves (like letting them take credit for work they didn't do). Anyway, here it's totally up to you (as long as you have the time to rewrite his code and do the tasks that were assigned to you by your boss).

If your company uses git, it will be automatically obvious who did what, so I wouldn't worry too much about the credit issue.

In any case, I would advise against rewriting his code for him. If your friend seems to want to learn and be a better developer, I would help him by giving him advice, maybe some code snippets.

6

I can see a lot of flaws in his code already and I want him to learn, at the same time I strongly feel that I want to review his code formally just so that people know that I have helped him in coming up with a better code than what he already has, another reason is because I want him to work hard and not have everything spoon-fed to him.

OK, there's a lot going on in that statement. Let me break it apart.

I can see a lot of flaws in his code already and I want him to learn

Are these flaws quantifiable, meaning would any other developer also see them as flaws, or is this your opinion? Are you being subjective or are you being objective in your analysis?

at the same time I strongly feel that I want to review his code formally just so that people know that I have helped him in coming up with a better code than what he already has

Is your goal to help your friend or is your goal to get some kind of credit for yourself for helping your friend? What's your true motivation?

another reason is because I want him to work hard and not have everything spoon-fed to him

That's a bit condescending. How do you know that this person doesn't work hard? Are you the arbiter of who works hard and who doesn't? Do you make the determination of what level of effort constitutes hard work?

Is asking you to review his code analogous to being spoon-fed? Is he asking you to review it or to correct it? Is he asking you to do his work and research for him? If not, then he's not being spoon-fed.

  • Yes, these flaws are quantifiable such as improving code readability and efficiency.. I would not write his code, but i need to have things on record that I reviewed his code. Yes i would say he's not hard-working because I have seen him vacationing several times and not meeting deadlines. Effort level constitutes of trying to independently find a solution and learning from your mistakes and improve upon them, i'm talking about the same effort level it takes to research enough and ask a good question on stack overflow. – Sujith Shivaprakash Mar 25 at 2:03
0

It all pivots around the question if your friend has the professional authority to ask you for this. If not (which i have the impression of) then it is a personal favor, i.e. off the clock, and off the record. Do not let the work assigned to you by your boss rest because of this task.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.