Asking for a Code Example
请对方给个代码示例
读完你能用英语向别的团队要到一段能跑的示例代码:先说自己已经查过什么,再点出卡在哪一个具体环节,然后主动把门槛降到『再丑也行』。文中还教你拿到答案后怎么回补文档,把一次人情变成整个团队的收益,以及四句可以直接照抄的话。
当前浏览器暂不支持语音朗读
Scene: Priya has to call another team's payments service by Friday. The documentation lists every field and shows nothing being used. She has read it three times. What she needs is twenty lines of working code from someone who has already done it. Marco owns that service. The message she sends him will decide whether she gets an answer today or on Monday.
Priya: Hi Marco. I need to wire up the checkout flow to the payments service and I am stuck on the refund call. I have read the reference page, so I know the field names — what I cannot work out is the order of the calls. Do you have a snippet from a real integration I could look at? Even an ugly one from an old branch would help. Marco: Give me ten minutes.
Three things earned that reply. She said what she had already read, so Marco knew she was not asking him to do her homework. She named the exact gap — the order of the calls, not "how does this work". And she lowered the bar on purpose. "Even an ugly one" gives him permission to send something imperfect, which is the only kind of code anyone can send in ten minutes.
Marco: Here is the version we use internally. Ignore the logging. One thing the docs do not say: you have to create the refund object before you void the authorisation, or you get a 409. Priya: That is exactly what I was doing wrong. Can I add that line to the docs page? I will credit you. Marco: Please do. Three people have asked me this month.
That last exchange is the part people forget. Priya did not just take the answer and disappear. She offered to write it down, which turns a private favour into a public one and makes Marco look good in the process. Ask for a snippet once and you owe someone ten minutes. Ask, then document, and you have paid the whole team back.
Compare that with the message Marco usually gets: "Hey, quick question about payments — free for a call?" It hides the question, it asks for a meeting before he knows if one is needed, and it forces him to reply just to find out what is wanted. If a snippet would have solved it, a thirty-minute call is a tax on both of you.
Keep four sentences in your back pocket. "Here is what I have already tried." "The specific bit I am stuck on is X." "Do you have a working example I could copy from?" "Even a rough one is fine." Swap the nouns and this works for a config file, a query, a deployment script, or a design token. The shape does not change.
One more thing about tone. Asking for an example is not an admission that you are weak. It is a statement that your time and his time are both worth something. The engineers who look senior are rarely the ones who never ask. They are the ones who ask precisely, close the loop, and leave the place easier for the next person.