15种最常见的不良编程习惯

Here are some most common bad programming practices that every programmer should avoid to become a better programmer.

这里是一些最常见的不良编程习惯,每个程序员都应避免成为更好的程序员。

Also Read: 5 Tips to Become a Better Programmer

另请阅读: 成为更好的程序员的5条技巧

1. Giving up too soon

1.放弃太早

Most of the programmers give up when they are very close to solution. So never lose hope and keep trying, you will definitely find a solution.

大多数程序员在非常接近解决方案时就放弃了。 因此,永远不要失去希望并继续尝试,您一定会找到解决方案的。

Top 15 Bad Programming Practices

Image Source

图片来源

2. Acting defensively when someone critiques your code

2.当有人批评您的代码时采取防御措施

Be calm when someone criticizes your code. Just listen carefully to them; maybe it will help you to improve your code quality.

当有人批评您的代码时保持冷静。 只是仔细听他们讲。 也许它将帮助您提高代码质量。

3. Refusing to ask for help

3.拒绝寻求帮助

Don’t be ashamed of asking help from other programmers. Don’t feel that others will think you even don’t know such a small thing. Just go ahead and ask for help. There are several programming forums like stackoverflow where many experienced programmers are active who would definitely help you.

向其他程序员寻求帮助不要感到羞耻。 不要以为别人会认为你甚至都不知道这么小的事情。 只是继续寻求帮助。 有一些编程论坛,例如stackoverflow,许多经验丰富的程序员活跃在现场,他们肯定会为您提供帮助。

4. Passing blame to others

4.责备他人

A good developer is one who takes ownership and responsibility for the code he/she write.

优秀的开发人员是对自己编写的代码拥有所有权和责任的开发人员。

5. Ignoring the opinions of other developers

5.忽略其他开发商的意见

Pair programming with other experienced developer is one of the best ways to learn and grow as a developer. You can take help of other programmers and senior developers to learn efficient ways of solving a problem that you have solved yourself.

与其他经验丰富的开发人员结对编程是学习和成长为开发人员的最佳方法之一。 您可以在其他程序员和高级开发人员的帮助下,学习解决自己解决的问题的有效方法。

6. Not knowing how to optimize code

6.不知道如何优化代码

Finding solution of a problem should not be your only concern. You should optimize your code in terms of time and space complexity.

寻找问题的解决方案不是您唯一关心的问题。 您应该在时间和空间复杂度方面优化代码。

7. Acting like a boss, not a leader

7.扮演老板而不是领导者的角色

If you are a senior developer then you should know how to manage developers in your team. You should act like a leader who can properly lead his/her team.

如果您是高级开发人员,那么您应该知道如何管理团队中的开发人员。 您应该扮演一个能够正确领导他/她团队的领导者。

8. Using the wrong tool for the job

8.使用错误的工具进行工作

You should be aware of which tool is best for the job. Stop making decisions based on “it’s what I know”. You need to be open to using different technologies, languages, and frameworks.

您应该知道哪种工具最适合这项工作。 停止基于“这就是我所知道的”做出决策。 您需要开放使用不同的技术,语言和框架。

9. Refusing to research coding questions

9.拒绝研究编码问题

Internet is one of the most powerful tools for programmers. You should be really smart to search solution for a problem on sites like google, stackoverflow, etc.

互联网是程序员最强大的工具之一。 您应该非常聪明,可以在google,stackoverflow等网站上搜索问题解决方案。

10. Refusing to learn from mistakes

10.拒绝从错误中学习

We are humans, we make mistakes. Making mistake is not a bad thing, but refusing to learn from them is bad thing. Find the ultimate cause for the mistake and keep it in mind so that you will not repeat it in future.

我们是人类,我们犯错误。 犯错不是一件坏事,但是拒绝向他们学习是一件坏事。 找到导致错误的最终原因,并牢记在心,以便将来不再重复。

11. Separating yourself from the developer community

11.与开发者社区分开

You should be really active in developers and programmers community. This will help you to have knowledge about latest technologies and trends in the market.

您应该在开发人员和程序员社区中真正活跃。 这将帮助您了解市场上的最新技术和趋势。

12. Not giving back to the community

12.不回馈社会

You should be always ready for helping other programmers. You can help others by various platforms like stackoverflow, quora, etc. or by writing articles on others or your own blog.

您应该时刻准备着帮助其他程序员。 您可以通过各种平台(例如stackoverflow,quora等)或在他人或您自己的博客上撰写文章来帮助他人。

See how I am helping other programmers by this blog. 🙂

通过此博客了解我如何帮助其他程序员。 🙂

13. Struggling for hours to solve something, solving it, and not documenting it

13.努力工作几个小时才能解决,解决问题,而不是记录在案

You may get some strange problem whose solution is not there on internet. You spent several hours and found the solution. Now it’s your duty to share the solution on internet so that others will not struggle that much.

您可能会遇到一些奇怪的问题,其解决方案不在Internet上。 您花了几个小时找到解决方案。 现在,您有责任在Internet上共享解决方案,这样其他人就不会那么费劲。

14. Bad naming conventions

14.错误的命名约定

Use meaningful name for variables, functions, classes, etc. For example, using characters like x, y, z, etc for the variable name instead of something like length, userInput.

对变量,函数,类等使用有意义的名称。例如,对变量名称使用x,y,z等字符,而不要使用诸如length,userInput之类的字符。

15. Writing too many or not enough comments in code

15.在代码中编写过多或不足的注释

Comments are essential notes to developers. It increases the readability of code. You should properly write comments so that it will help you as well as other programmers to understand the code in future.

注释是对开发人员的重要说明。 它提高了代码的可读性。 您应该适当地编写注释,以便将来帮助您以及其他程序员理解代码。

If you know some other bad programming habits then please mention in comment. I will love to add them in this article.

如果您知道其他不良的编程习惯,请在评论中提及。 我很乐意在本文中添加它们。

Source: https://www.quora.com/What-are-some-bad-programming-practices-every-programmer-needs-to-be-aware-of-in-order-to-avoid-them

来源: https : //www.quora.com/What-are-some-bad-bad-programming-practices-every-programmer-needs-to-be-aware-of-in-order-to-avoid-them

翻译自: https://www.thecrazyprogrammer.com/2016/11/bad-programming-practices.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值