10

I recently was assigned the task of writing a piece of code for a very specific function.

It wasn't complicated or anything massive, but it did take a couple hours. After I completed it, I realized that there was a very similar piece of code already in the codebase.

After asking around, it turned out that my coworker who works with me and I share an office space with had already written a function for this same purpose.

In the ticket which was assigned to me, it had previously been assigned to my coworker, but they had never updated the ticket in our project management platform, to reflect the work done. Updating the ticket as soon as the work had been completed would have been standard practice in our work environment.

Basically, the project manager and my coworker had failed to communicate that this work had been done, and since the PM did not think any progress had been made, they assigned it to me.

Since I had found the old code, I asked my coworker casually if they remembered writing it. They did, and then informed me that I had 'wasted my time' rewriting it, and that I 'should have checked' before working on the ticket.

The tricky part is that my coworker is definitely my senior, and I am fairly new to this type of work, but comparing the two pieces of code side-by-side, my code accomplishes the desired effect in about 30% as many lines, and maintains a much higher level of efficiency. To be frank, my code is better in any metric.

I committed the code anyways, but I was overwhelmed by feelings that I had perhaps been passive-aggressive by submitting my code to the codebase, instead of scrapping it altogether.

I told my coworker that I had gone ahead and committed the code anyways, just to show that I had done the work assigned to me.

This was met with a very awkward back and forth between us.

It definitely made for some tense times, especially when my coworker said, "You're code looks good, but don't take it personally if I end up deleting it(and using their implementation)."

What could I have done better here? I'm pretty junior, so this was very awkward.

I just didn't want to pretend like I hadn't done the task, as then it would have looked like I had been very unproductive for the day, and reflected poorly on me.

tl;dr: lack of communication led to me doing work that had already been done. I didn't want to just hit the delete key on multiple hours of work, so I committed it anyways, leading to an awkward encounter/shift in relationship with my coworker who I work with daily.

2
  • 1
    The only think you missed I think is when you see a ticket was assigned to another coworker before, ask him verbally if he did something on it, or if he even took a look, even if he didn't do the work, if he looked you could use his advice, considering he's a senior.
    – Walfrat
    Dec 19, 2016 at 10:35
  • 1
    Yeah, it was assigned to him and you should've asked when you saw that, but your colleague is being a jerk. Sadly there's not much you can do about that except managing your expectations and covering yourself whenever possible.
    – rath
    Dec 19, 2016 at 11:08

5 Answers 5

27

It was a ticket assigned to you by a PM and you completed it. Mark it as complete.

If your coworker wants to delete it then let them. If your PM asks you what happened then tell them.

It was just 2 hours of work. No need to escalate this. You want it to play out with as little fan fair as possible.

2
  • 4
    It's also in version control, so it can be recovered if anyone cares later. Dec 19, 2016 at 4:41
  • Thanks. Simple answer. Logical conclusion. No need for this to be a bigger deal than the orginal small awkward encounter.
    – mrmax
    Dec 21, 2016 at 16:45
5

So you were given a ticket to write code. You wrote the code, and I assume that you are confident that it is well written and works well. The code only needs to be checked in, reviewed and tested. And that's when you find out there is a different version already.

The obvious thing is that you still check in your code because you know its quality and that it works. You have no idea what state that other code is in, so before you could check it in, you would have to thoroughly examine it, which again costs time, and it might be incomplete and unfinished so you would have to finish it which costs more time. Total waste of time.

As far as your co-workers argument goes, that's nonsense. He wasn't organized enough to mark this item as "in progress" or "finished". It's not your job to search for work that someone didn't record properly. If you had to, you would have to do that every time, and most of the time it would be a waste.

If your co-worker deletes your code, he will have some explaining to do why he is deleting perfectly fine, reviewed, and needed code and replace it with something that is less good and not reviewed.

3

You did the code. Good for you.

Report to your PM and team lead that you completed the assignment without being aware or being made aware that the senior engineer had already written a block of code with the same functionality because this code was never reported as existing in the ticketing system, and that you depend on the ticketing system to check on whether things have been done or whether they are up to date.

If anyone pushes back and says that you should have asked, say that what happened is exactly why the ticketing system has to be up to date at all times. You can't be reasonably expected to check the ticketing system AND ask everyone around you as a paranoia check.

Summarize your report and say in conclusion that the company is now in possession of two blocks of code with the same functionality, but you estimate that yours is better by 30% :)

Keep a copy of your code and run it by the team lead so that they can comparison shop. If your code looks great to your team lead, you may get more challenging assignments as a result.

I wouldn't agonize about a couple of hours being wasted, given that you are blowing 2000 to 2500 hours of your life per calendar year doing your job.

2

What you could have done better, and the way I would have handled it, is: tell your PM what you have told us.

I worked on this issue no. 1234 for a couple of hours, then remembered having seen this code somewhere before. I asked around and found out that Mr. Coworker had already written some code for issue no. 1111, although it was not released. Should I go ahead with committing my changes, or mark this issue as a duplicate after Mr. Coworker releases his code?

Then let the PM take the call, do as he says, and move on to the next issue/work item. There is nothing to be gained from doing a song and dance about your coworker forgetting to update the bugtracker.

1

I would say you should try to move forward from this incident as best you can. Your coworker screwed up by not marking the ticket complete, which would have made it unnecessary for you to check his work in the code. This is why you have a ticket system. Your PM also screwed up by reassigning the ticket instead of getting a clear answer from the senior developer as to why the ticket was stuck in limbo.

I think 'Your code looks good' was essentially their apology to you (sometimes that's just what apologies sound like.) It's probably not going to get deleted or replaced unless your coworker is really self-centered. Fortunately, you know your work was good, and that it did get submitted to the code base (and merged, I assume ;))

If you find yourself assigned to one of his tickets again, check with the PM to make sure they followed up appropriately. If this is another situation where he forgot to update his ticket, say: 'I like communicating with you, Sr. Developer Bob, but mostly about where we go to lunch, and not the status of your tickets. That's why we have a ticket system, so that I don't have to interrupt your work to stay on the same page."

And the third time it happens, don't even tell him. Just do the work assigned to you. It's his job to keep track of his own.

1
  • It could be deleted if code that's already in place uses the coworker's code and would have to be refactored and go through QA again. Dec 19, 2016 at 4:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .