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.
我穿上长袍,打开一罐苏格拉底方法。
苏格拉底方法以古希腊哲学家苏格拉底的名字命名,是一种哲学探究的形式,提问者探究他人立场的含义,以激发理性思考和阐明思想。这种辩证方法经常涉及到一种对立的讨论,在这种讨论中,一种观点的辩护与另一种观点相对抗;一个参与者可能会导致另一个人在某种程度上自相矛盾,加强询问者自己的观点。
如果你有一个松散的编码标准,能够指出这一点,或者表明你不能遵循代码,因为它不是正确的格式可能是值得的。
如果您没有编码格式,现在将是一个好时机。类似于这个问题的答案可能会有帮助:https://stackoverflow.com/questions/4121/team-coding-styles
让有问题的人就他们编写的代表性模块的代码向小组的其他成员准备一份演示文稿,并让问答环节来处理(相信我,它会的,如果这是一个优秀的小组,它甚至不应该变得丑陋)。
推荐文章
- 检查字符串是否包含字符串列表中的元素
- 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