I just had one of our API users tell me that >...
# random
g
I just had one of our API users tell me that
waiting for the connection takes a long time so I use a hard-coded
sleep(5.seconds)
in my code
for users of #C1CFAFJSK, do you guys find junior developers (or any developers) doing this kind of thing for asyncs? Rather than synchronize properly (maybe because that involves bubbling some future up a call stack or converting a future to a channel for more granular synchronization), they simply insert hard-coded wait statements? I'm kinda mortified. I really don't want to have to explaining concurrency to somebody who works for another company. I want to just say "you're an idiot, call the WaitFor method, and dont ever use this strategy again." Now I have to find a way to put that into an email nicely...
🫤 2
l
Just say how dangerous it is and how it can break and make them spend days debugging in vain.
t
I imagine in this case is more lack of knowledge than malice, so ideally trying to explain will both be helpful for you, as they will understand to no to it anymore and for them, for understanding why it's not the ideal way and getting better as a dev in general. But I agree that sometimes is not easy :)
l
You could also add a bit of irony like saying: We will make it last 6 seconds as soon as you have deployed your 5 seconds hardcoded delay.
😈 3
👏🏾 1
👏 1
d
Agree with others, but suggest also sending one or two links to learning resources. You don't have to explain the whole thing... Just tell them 'waiting' is a fundamentally broken approach and to read these references/topics to learn more.
d
just explain to him that this solution is not okay, ask him what would happen if the request takes 6 seconds or more and suggest him the better approach. You said he is from another company - idk if you know him, but he could just be a junior. No point in being a douche