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?


当前回答

人们编写糟糕的代码只是无知的一种症状(这与愚蠢不同)。这里有一些对付这种人的技巧。

Peoples own experience leaves a stronger impression than something you will say. Some people are not passionate about the code they produce and will not listen to anything you say Paired Programming can help share ideas but switch who's driving or they'll just be checking email on their phone Don't drown them with too much, I've found even Continuous Integration needed to be explained a few times to some older devs Get them excited again and they will want to learn. It could be something as simple as programming robots for a day TRUST YOUR TEAM, coding standards and tools that check them at build time are often never read or annoying. Remove Code Ownership, on some projects you will see code silos or ant hills where people say thats my code and you can't change it, this is very bad and you can use paired programming to remove this.

其他回答

我很喜欢代码,在我的生活中从来没有上过任何与信息学相关的课程,我一开始很糟糕,开始从例子中学习,但自从我读了“四人帮”这本书以来,我一直记得并一直在我的脑海中:

“每个人都能写出机器能理解的代码,但不是所有人都能写出人类能理解的代码。”

考虑到这一点,在代码中有很多事情要做;)

以一种非对抗性的方式提出一个更好的选择。

“嘿,我觉得这个方法也可以。你们怎么看?”[用手势表示屏幕上的代码明显更好]

使用一些wiki软件在你的网络上创建一个wiki。

在你的网站上开始一个叫做“最佳实践”或“编码标准”的类别。

把每个人都指向它。允许反馈。

当您发布软件时,让负责将代码放入构建中的人员向开发人员推送,让他们指向上面的Wiki页面。

我曾在我的组织中这样做过,人们花了几个月的时间才真正熟悉使用Wiki,但现在它是一个不可或缺的资源。

与其让他们写代码,不如让他们维护代码。

除非他们不得不维护他们那堆冒着热气的意大利面,否则他们永远不会明白自己在编码方面有多糟糕。

让有问题的人就他们编写的代表性模块的代码向小组的其他成员准备一份演示文稿,并让问答环节来处理(相信我,它会的,如果这是一个优秀的小组,它甚至不应该变得丑陋)。