6 ms·
> returning a null array to represent no items, and returning a single object without an array to represent one item. This just reminded me of a long ago inci
by hermitdev 7y ago
> returning a null array to represent no items, and returning a single object without an array to represent one item.
This just reminded me of a long ago incident at a former employer. I worked in back-office at a hedge fund and was responsible for maintaining several APIs & services written in C++. The APIs were pretty straight forward query for object(s), get back a vector of objects. If nothing was found, you'd get back an empty vector.
The company also had a program where they'd hire grad students right out of school and immerse them in the trading desk, working on trading algorithms and such. One such kid sent in a "bug report" directly to me, CCing all of front office. The "bug"? We was querying for something that didn't exist, so he got back an empty vector. He didn't check that it wasn't empty, and immediately accessed the front of the vector. Boom, segfault.
Normally, I would have been kind to such a junior dev, but their original email was very condescending and went to an unnecessarily large audience - like hundreds of people that didn't have time for this. His email read something to the effect of "Your API is crashing my code. Fix your API."
Instead, this junior got a whole other lesson instead. I replied all, and included all of back-office on the email (so the rest of the team was aware to watch out for this clown). "The API is working perfectly fine and as designed. The fuck up is on your end. You queried for something that doesn't exist and proceeded to dereference and empty vector. Fix YOUR fucking code."
- sealthedeal 7y agoI would expect an empty array to always be returned regardless
- tbirdz 7y agoI really don't like your story. The junior is clearly behaving immaturely and inappropriately by CCing others and not using an appropriate tone, but your response is to... retaliate by doing the exact same thing to him? What lesson is the junior supposed to learn here? That acting that way is A-OK as long as you have seniority and are factually correct? At least the junior has the "excuse" of being a junior, but really as a more senior person you should have known better. Surely there must have been a better way for you to handle this situation.
- dx87 7y agoI'm not seeing anything wrong with what OP did. By CCing everyone, the junior is trying to make themselves look good by making OP look bad. The junior learned that if they act like an ass, especially an incorrect ass, the other employees won't tolerate it.
- ergothus 7y agoThat's the DESIRE for what the junior learned. But is that what they actually learned? One could just as easily (or more easily) decide instead that this is the way business is done. It's literally all they've ever seen.
- kelnos 7y agoResponding politely could also teach the junior that it's ok to act like an asshole, because he'll get a polite response no matter what. I suppose the ideal response would have been a polite correction, followed by a polite rebuke regarding the junior's tone and behavior, but I can't fault someone for responding to fire with fire on occasion.
- ergothus 7y agoA polite response does not have to be a meek response. You can be blunt, you can point out all the problems, while still being polite. That also has the advantage of being 100% clear. "You just told hundreds of people my code is poor. You attacked me, and my professional reputation, and you did it inaccurately. This gives me little reason to respect you or want to help you. Asking without copying the world and without assuming you were flawless would have done a lot to help your case. Because I AM professional and you are new to the profession, I'll hold back on the reflex to point out to every one of these hundreds of peers that influence your career how rude, presumptive, and WRONG you were. Instead, I'm pointing out in private that you are wrong and not behaving in a way someone looking to succeed is behaving. This tolerance is not something you should expect from me again, and you should be grateful to be getting it now because your behavior does NOT call for cooperation. If you do this again, the next person will likely not show this patience and understanding. Do you understand that you made the error in your code? Do you understand how your behavior invites people to think poorly of you? Do you understand how to change both your code and behavior for the future? " This has the senior developer takes on more work instead of a sense of vindication. However, this is much more likely to get a positive result in the long term - there's no mystery hope that someone that clearly missed out on social repercussions will suddenly understand them when attacked. Being a senior developer is not about winning battles, it's about learning to win without battles, and even more importantly, it's about TEACHING that.
- kbenson 7y agoReally, there are many reasons to run internal mailing/distribution lists and designate emails from them in some manner, such as a subject prefix. One of which is that people are less likely to sent an email to the "Staff" list if most the correspondence there is from management and about company level things, and then it's also very appropriate to reply to the email with content that addresses the request (in this case, you're wrong, don't do that) and also a rider about how this is not the appropriate place for this, and they should submit to the appropriate list/form.
- nurettin 7y agoHow did your API endpoint signal internal errors or parameter errors to the client?