你如何告诉别人他们写错码? [英] How do you tell someone they're writing bad code?

查看:108
本文介绍了你如何告诉别人他们写错码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在与一小群人一起编写一个编程项目,以获得乐趣。这是一个有组织和相当凝聚力的团体。我工作的人都有与编程相关的各种技能,但其中一些使用旧的或彻底的错误方法,如过多的全局变量,不良的命名约定和其他事情。虽然事情工作,实施是穷人。有礼貌地询问或介绍他们如何使用更好的方法,而不是作为质疑(或侮辱)他们的经验和/或教育?

I've been working with a small group of people on a coding project for fun. It's an organized and fairly cohesive group. The people I work with all have various skill sets related to programming, but some of them use older or outright wrong methods, such as excessive global variables, poor naming conventions, and other things. While things work, the implementation is poor. What's a good way to politely ask or introduce them to use better methodology, without it coming across as questioning (or insulting) their experience and/or education?

推荐答案

介绍问题,让他们意识到他们在做什么是错误的。例如,请问这些问题:

Introduce questions to make them realise that what they are doing is wrong. For example, ask these sort of questions:


为什么决定创建一个全局变量?

Why did you decide to make that a global variable?

你为什么给它这个名字?

Why did you give it that name?

这很有趣。我通常这样做,因为[插入原因为什么你更好]

That's interesting. I usually do mine this way because [Insert reason why you are better]

这样工作吗?我通常[插入你会如何让他们看起来傻]

Does that way work? I usually [Insert how you would make them look silly]

我认为理想的做法是巧妙地问他们为什么代码以一定的方式。你可能会发现他们相信有其他方法的好处。除非我知道他们的编码风格的原因是由于错误的信息,我永远不会判断我的方式更好没有良好的理由。最好的方法是问他们为什么选择这种方式;一定要对他们的推理感兴趣,因为这是你需要攻击,而不是他们的能力。

I think the ideal way of going about this is subtly asking them why they code a certain way. You may find that they believe that there are benefits to other methods. Unless I knew the reason for their coding style was due to misinformation I would never judge my way as better without good reason. The best way to go about this is to just ask them why they chose that way; be sure to sound interested in their reasoning, because that is what you need to attack, not their ability.

编码标准肯定会有帮助,但如果是每个软件项目的答案,那么我们都会在天堂的私人岛屿上喝鸡尾酒。在现实中,我们都容易出现问题,软件项目的成功率仍然很低。我认为问题主要来源于个人能力,而不是常规的问题,这就是为什么我建议一个问题作为一个群体,当一个问题解决它的丑陋的头。

A coding standard will definitely help, but if it were the answer to every software project then we'd all be sipping cocktails on our private islands in paradise. In reality, we're all prone to problems and software projects still have a low success rate. I think the problem would mostly stem from individual ability rather than a problem with convention, which is why I'd suggest working through the problems as a group when a problem rears its ugly head.

最重要的是,不要立即假设您的方式更好。在现实中,它可能是,但我们正在处理另一个人的意见,他们只有一个解决方案。不要说你的方式是更好的方式,除非你想让他们看到你作为一个smug的输家。

Most importantly, do NOT immediately assume that your way is better. In reality, it probably is, but we're dealing with another person's opinion and to them there is only one solution. Never say that your way is the better way of doing it unless you want them to see you as a smug loser.

这篇关于你如何告诉别人他们写错码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆