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?
当前回答
我真的很喜欢EnderMB的回答,但我想补充一点:
培养一种鼓励讨论代码质量的环境,而不是将其视为敏感或禁忌。例如,我曾在一个开源项目(一个Python库)中工作,团队经常讨论新代码和错误修复。不仅可以说“嘿,我认为这样做更好”,而且这实际上是被鼓励的,也是我们用于维护高质量代码的过程的一部分。
我知道不是每个环境都有利于这种过程,但它确实对我们很有效。每一次代码提交并不一定是一次委员会会议,但它应该是完全可以接受的,您可以讨论有问题的或非最优的代码并寻求改进。毕竟,更好的代码对团队中的每个人都有好处,团队合作的一个主要概念是一起工作,而不是松散的个人团体。
其他回答
在他面前重构他的代码,并显示两个版本之间的差异。他肯定会喜欢的。
耐心再怎么强调都不为过。我见过这种完全事与愿违的事情,主要是因为有人希望现在就发生变化。相当多的环境需要进化的好处,而不是革命。今天强行改变,可能会给所有人带来一个非常不愉快的环境。
接受是关键。你的方法需要考虑到你所处的环境。
听起来你所处的环境有很多“个性”。所以…我不建议使用一套编码标准。你会发现你想把这个“有趣”的项目变成一个高度结构化的工作项目(哦,太好了,接下来是什么……功能文件?)相反,正如其他人所说,你必须在一定程度上处理它。
Stay patient and work toward educating others in your direction. Start with the edges (points where your code interacts with others) and when interacting with their code try to take it as an opportunity to discuss the interface they've created and ask them if it would be okay with them if it was changed (by you or them). And fully explain why you want the change ("it will help deal with changing subsystem attributes better" or whatever). Don't nit-pick and try to change everything you see as being wrong. Once you interact with others on the edge, they should start to see how it would benefit them at the core of their code (and if you get enough momentum, go deeper and truly start to discuss modern techniques and the benefits of coding standards). If they still don't see it... maybe you'll need to deal with that within yourself (especially on a "fun" project).
耐心。进化,而不是革命。
祝你好运。
我和和我一起工作的人有类似的情况。他们不像我那样接触编码,但他们在编码方面仍然很有用。
而不是我让他们做他们想做的然后回去编辑整篇文章。我通常只是让他们坐下来,告诉他们两种做事的方法。他们的方式和我的方式,从这里我们讨论了每种方法的优缺点,因此对我们应该如何进行编程有了更好的理解和更好的结论。
这是真正令人惊讶的部分。有时他们会提出一些连我都不知道答案的问题,经过研究,我们都对方法论和结构有了更好的概念。
讨论。 告诉他们为什么 甚至不要认为你总是对的。有时甚至他们也会教你一些新东西。
如果我是你,我也会这么做
我穿上长袍,打开一罐苏格拉底方法。
苏格拉底方法以古希腊哲学家苏格拉底的名字命名,是一种哲学探究的形式,提问者探究他人立场的含义,以激发理性思考和阐明思想。这种辩证方法经常涉及到一种对立的讨论,在这种讨论中,一种观点的辩护与另一种观点相对抗;一个参与者可能会导致另一个人在某种程度上自相矛盾,加强询问者自己的观点。
代码标准的想法是一个很好的想法。
但考虑一下不要说什么,尤其是因为这是为了好玩,而且大概是和你的朋友。这只是代码……
推荐文章
- 检查字符串是否包含字符串列表中的元素
- codestyle;把javadoc放在注释之前还是之后?
- .toArray(new MyClass[0]) or .toArray(new MyClass[myList.size()])?
- 你如何告诉别人他们写的代码不好?
- main()中的Return语句vs exit()
- 对于一个布尔字段,它的getter/setter的命名约定是什么?
- 为什么CSS选择器/ HTML属性首选破折号?
- 在c++中使用"super
- 在PHP中使用getter和setter而不是函数或简单的公共字段有什么优点?
- foo到底是什么意思?
- 什么时候使用“this”关键字?
- 对Python ' import x '和' from x import y '语句排序的正确方法是什么?
- 在Python中创建空列表
- 将c++定义放在头文件中是一个好习惯吗?
- 使用“for”循环遍历c++ Vector