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?


当前回答

Privately inquire about some of the "bad" code segments with an eye toward the possibility that it is actually reasonable code, (no matter how predisposed you may be), or that there are perhaps extenuating circumstances. If you are still convinced that the code is just plain bad -- and that the source actually is this person -- just go away. One of several things may happen: 1) the person notices and takes some corrective action, 2) the person does nothing (is oblivious, or doesn't care as much as you do).

如果#2发生了,或者从你的角度来看,#1并没有带来足够的改进,并且它正在损害项目,并且/或对你造成了足够的影响,那么可能是时候在团队中开始建立/执行标准了。这需要管理层的支持,但只有从基层做起才最有效。

祝你好运。我能感受到你的痛苦,兄弟。

其他回答

在他面前重构他的代码,并显示两个版本之间的差异。他肯定会喜欢的。

没有人喜欢听别人说他们的工作很糟糕,但任何理智的人都会欢迎指导和避免不必要工作的方法。

有一种教学流派甚至说,你不应该指出错误,而应该专注于做对的事情。例如,与其指出难以理解的代码不好,不如指出他们的代码特别容易阅读的地方。在第一种情况下,你会引导其他人像蹩脚程序员一样思考和行动。在后一种情况下,你会像一个熟练的专业人士一样思考。

首先,我会注意不要太快下结论。有些代码很容易被认为是坏的,尽管可能有很好的理由(例如:使用带有奇怪约定的遗留代码)。但让我们暂时假设他们真的很糟糕。

你可以建议建立一个基于团队输入的编码标准。但是你真的需要考虑他们的意见,而不仅仅是强加你对好的代码应该是什么样子的看法。

另一种选择是把技术书籍带进办公室(《代码完成》、《有效的c++》、《实用的程序员》……),并主动把它借给别人(“嘿,我用完了,有人想借吗?”)

您可能想要关注坏代码的影响,而不是您对它的风格是好是坏的主观看法。

Privately inquire about some of the "bad" code segments with an eye toward the possibility that it is actually reasonable code, (no matter how predisposed you may be), or that there are perhaps extenuating circumstances. If you are still convinced that the code is just plain bad -- and that the source actually is this person -- just go away. One of several things may happen: 1) the person notices and takes some corrective action, 2) the person does nothing (is oblivious, or doesn't care as much as you do).

如果#2发生了,或者从你的角度来看,#1并没有带来足够的改进,并且它正在损害项目,并且/或对你造成了足够的影响,那么可能是时候在团队中开始建立/执行标准了。这需要管理层的支持,但只有从基层做起才最有效。

祝你好运。我能感受到你的痛苦,兄弟。