How do I take responsibility for my code when colleague makes unnecessary improvements without notice?

One of my teammates is a jack of all trades in our IT shop and I respect his insight.

However, sometimes he reviews my code (he’s second in command to our team leader, so that’s expected) without a heads up. So sometimes he reviews my changes before they complete the end goal and makes changes right away… and has even broken my work once.

Other times, he has made unnecessary improvements to some of my code that is 3+ months old.

This annoys me for a few reasons:

  1. I am not always given a chance to fix my mistakes
  2. He has not taken the time to ask me what I was trying to accomplish when he is confused, which could affect his testing or changes
  3. I don’t always think his code is readable
  4. Deadlines are not an issue and his current workload doesn’t require any work in my projects other than reviewing my code changes.

Anyways, I have told him in the past to please keep me posted if he sees something in my work that he wants to change so that I could take ownership of my code (maybe I should have said “shortcomings”) and he’s not been responsive.

I fear that I may come off as aggressive when I ask him to explain his changes to me.

He’s just a quiet person who keeps to himself, but his actions continue. I don’t want to banish him from making code changes (not like I could), because we are a team–but I want to do my part to help our team.

Added clarifications:

  • We share 1 development branch. I do not wait until all my changes complete a single task because I risk losing some significant work–so I make sure my changes build and do not break anything.
  • My concern is that my teammate doesn’t explain the reason or purpose behind his changes. I don’t think he should need my blessing, but if we disagree on an approach I thought it would be best to discuss the pros and cons and make a decision once we both understand what is going on.
  • I have not discussed this with our team lead yet as I would prefer to resolve personal disagreements without getting management involved unless it is necessary. Since my concern seemed more of personal issue than a threat to our work, I chose to not bother the team lead. I am working on code review process ideas–to help promote the benefits of more organized code reviews without making it all about my pet peeves.

21

I think most developers find themselves in this position at some point, and I hope that every developer who’s felt victimized realizes how frustrating it will be when he or she becomes the senior and feels compelled to clean up code written by juniors.

For me, avoiding conflict in this situation comes down to two things:

  1. Courtesy. Talking to someone about his/her code allows a dev to know that you’re interested and you can discuss it as grown up professionals.

  2. Forget about “code ownership” – the team owns the code. Other people wanting to make the changes is a good thing. If a senior dev makes changes that are “unreadable” or worse, then back them out. You don’t need to be aggressive, just let an editor know that his/her changes didn’t work, and you’re more than happy to discuss your reversion.

Remember, team ownership of code is great and it cuts both ways. If you see something that doesn’t make sense in someone else’s code, then fix it. Being overly possessive and inadequately communicative is a surefire way to a create a poisonous development environment.

18

You and most of the answerers approach this as a communication issue between two colleagues, but I don’t really think it is. What you describe sounds more like a horribly broken code review process than anything else.

First, you mention that your colleague is second in command and it’s expected that he’ll review your code. That’s just wrong. By definition, peer code reviews are not hierarchical, and they are certainly not just about finding defects. They can also provide learning experiences (for everyone involved), an opportunity for social interaction, and prove a valuable tool for building collective code ownership. You should also review his code from time to time, learn from him and correct him when he’s wrong (no one gets it right every time).

Furthermore, you mention that your colleague makes changes right away. That’s also wrong, but of course you already know it; you wouldn’t have asked this question if his gung ho approach wasn’t a problem. However I think you are looking for a solution in the wrong place. To be perfectly honest, your colleague reminds me a bit of… me, and what worked for me in similar situations was a well-defined and solid review process and a set of awesome tools. You don’t really want to stop your colleague from reviewing your code, and asking him to stop and talk to you before every little change is not really going to work. It might, for a while, but he’ll soon reach a point where it will just get too annoying and you’ll be back where you started, or worse: he’ll just stop reviewing your code.

A key to a resolution here might be a peer code review tool. I usually avoid product recommendations, but for code reviews Atlassian’s Crucible is really a life saver. What it does may seem very simple, and it is, but that doesn’t mean it’s not amazingly awesome. It hooks up to your repository and gives you the opportunity to review individual changesets, files or group of files. You don’t get to change any code, instead you comment on everything that doesn’t feel quite right. And if you absolutely must change someone else’s code, you can simply leave a comment with the changeset explaining your changes. The introductory video at Crucible’s product page is worth watching if you want more details. Crucible’s pricing is not for everyone, but there are numerous freely available peer review tools. One I’ve worked with and enjoyed is Review Board and I’m sure you’ll find a lot of others with a simple Google search.

Whatever tool you choose, it will completely change your process. No need to stop, get off your chair, interrupt the other person and discuss the changes; all you need to do is set some time off every week and go through the comments (once a week is just a suggestion. You know your schedule and daily routine better than I do). More importantly the core reviews are stored in a database somewhere and you can retrieve them at any time. They aren’t ephemeral discussions around the water cooler. My favourite use case for old reviews is when introducing a new team member to our codebase. It’s always nice when I can walk someone new through the codebase pointing out where exactly we were stuck, where we had differing opinions, etc.

Moving on, you mention that you don’t always find this colleague’s code readable. That lets me know that you don’t have a common set of coding standards, and that’s a bad thing. Again you may approach this as a people problem or you can approach this as a process problem, and again I would strongly suggest the latter. Get your team together and adopt a common coding style and set of standards as soon as possible. It doesn’t really matter if you chose a set of standards that’s common in your development ecosystem or you come up with your own. What really matters is for your standards to be consistent and that you stick to them. Lots and lots of tools out there can help you, but that’s a whole different discussion. Just to get you started, a very simple thing to do is having a pre-commit hook run some kind of style formatter on your code. You can continue writing your code however you like and let the tool “fix it” automagically before anyone else sees it.

Lastly you mention in a comment that management does not believe individual dev branches are necessary. Well, there’s a reason we call them “dev branches” and not “management branches.” I’ll stop here as there’s no reason for the rant that’s forming in my head to get out.

All that said, know that I don’t doubt your colleague is (a bit) at fault here. That’s not my point, my point is that your whole development process is also at fault, and that’s something that’s easier to fix. Arm yourself with the proper tools, explore the numerous formal and informal processes and pick those that fit your team. Soon you’ll reach a point where you’ll realize that most of your “people problems” don’t exist anymore. And please don’t listen to anyone (including yourself) that brings forth the “we’re a small team, we don’t need all that” excuse. A team of competent developers can set up the necessary tools in less than a week, automate everything that can be automated, and never look back again.

PS. “Code ownership” is a nebulous term, constantly debated, and it means different things to different people. You can find a brilliant collection of most of the differing (and sometimes antithetical) opinions on C2.

1

What is it about the process that makes you want to take responsibility for “your code” ? Do you have the sole responsibility to keep certain features working? Did the lead say “Michael, I want you to take responsibility for …” ? Or is your responsibility implicit, in that the lead and the rest of the team look to you every time certain features are broken?

Either way, if you have the responsibility, then you need authority over the code. The next time the other fellow makes unilateral changes and the lead comes back to you to fix them, you should sit down with the lead and ask to have your authority and responsibility aligned.

1

Not that this will solve the whole situation, but you might try adding more comments to your source code.

  1. If code is not complete, it could be marked as such.
  2. If the purpose of a block of code is not self-documenting, then you should document it.

All and all, try to make lemonade instead wasting time sucking on lemons.
As Michael said, in general, teammates aren’t out to make you look bad. Try to learn from your mistakes and apply them to future revisions.

If you believe that his changes are having a negative impact, please voice this (diplomatically). If it were me, I would simply ask why specific changes were done and see if you can defend your original changes. Your senior co-workers are human too. It’s quite possible that he missed something and/or is unaware of any negative impact he is providing.

7

Everyone implicitely ‘owns their own code’, regardless of the politics, legalistics, or economics – it’s the ‘nature of things’ – you naturally feel a personal connection to your own work.

If your co-worker is engaging in the behavior that you described and remains unresponsive when you ask for a heads up, that co-worker is discourteous, to say the least, and may be trying to undermine you (to say the worst…) – does NOT sound like a team player.

A good co-worker would touch base with you and point out the problem with your code to you – and let you fix/change it, or respond appropriately. I am very grateful that even when I was a newbee, my mentors always pointed out to me what I was doing wrong, explained why and let (or made) me fix it. That made me a better programmer and everyone benefited. And that’s what I have always done when reviewing work done by others. Then you, (or whoever) actually learns something from your ‘jack of all trades’, and the code and the team all get better, including your teacher: Teaching helps understanding.

If it’s at all possible, I would discuss the matter in private with the Team Leader. Based on your description of the situation, a good team leader will take your side – a bad one won’t…. Obviously this requires caution – you will have to judge that for yourself.

12

If you write code, then I should review it.

If I change your code during the review, then the code is not the code anymore that I reviewed, but code that I changed. Therefore it needs to be reviewed. Probably by you.

If I commit your new code with my changes without someone reviewing my changes, then I have committed (1) an unreviewed change, and (2) the worst possible sin if code reviews are taken seriously.

I think you are handling it the right way for now – but there will soon be a tipping point where it distracts you to the extent you might not be happy coding this way at all.

If I were you, I would request a quick one-to-one with this person and explain my PoV calmly yet firmly. Team ownership of code etc is all fine but unless you give every developer enough space to put his work out, make mistakes and improve you will never build good code. This can be a friction area sooner rather than later.

(There is a totally different answer if this was on workplace.stackexchange. Figuring out the correct way to do code reviews is the easy bit. Convincing your co-worker to comply with this is a lot harder).

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật