程序员沟通技巧_6种使程序员生活更轻松的技巧-程序员宅基地

技术标签: 算法  python  c++  java  人工智能  

程序员沟通技巧

Whether you are a novice or experienced programmer, following these helpful professional tips will save you time and greatly improve the quality of your code.

无论您是新手还是经验丰富的程序员,遵循这些有用的专业提示都将节省您的时间,并大大提高代码质量。

1)为人类而不是机器编写代码 (1) Make Code For Humans, Not just Machines)

When you are writing code, you must always think: Will another programmer understand what you have written? That other programmer may very well be your future self. To ensure readability, it’s essential to make your identifiers (i.e. variable and function names) consistent throughout your code. Additionally, designing a similar length, grammatical structure, and explanatory style when naming your functions will provide uniformity and help anyone who is reading the code.

在编写代码时,您必须始终思考:另一个程序员会理解您编写的内容吗? 那位其他程序员很可能就是您未来的自己。 为了确保可读性,必须在整个代码中使标识符(即变量名和函数名)保持一致。 此外,在命名函数时设计相似的长度,语法结构和解释样式将提供一致性,并帮助正在阅读代码的任何人。

Image for post
Martin Fowler
马丁·福勒

2)编写代码,您会记住 (2) Make Code You will Remember)

This won’t be the last code you write, so write code you will remember six months or a year from now. Name your methods with short but descriptive verbs representing the action they perform. When coding with numbers and strings, assign meaningful variables that will be recognizable later on. Using meaningless numbers, signs and symbols will only create frustration in the future. Keep it simple and straightforward.

这不是您编写的最后一个代码,因此编写代码将使您记住六个月或一年。 用简短但描述性的动词来表示您的方法,这些动词代表它们执行的动作。 使用数字和字符串编码时,请分配有意义的变量,这些变量稍后将被识别。 使用无意义的数字,符号和符号只会在将来造成挫败感。 保持简单明了。

3)使用正确的语言解决问题 (3) Use the Right Language to Solve the Problem)

When it comes to deciding which programming language to use, choose the right language for the project. Often new programmers try to cut corners and code with a language they already know, even if a different language is better suited for the task. Finding and using the correct language or tool for the project might increase the work but putting in the extra time will be worth it in the long run. Remember, it’s better to take the extra time and do a job right the first time, than to take shortcuts and have to go back and fix the loopholes you missed initially.

在决定使用哪种编程语言时,请为项目选择正确的语言。 即使不同的语言更适合该任务,新程序员也常常尝试使用他们已经知道的语言来偷工减料和编写代码。 为项目找到和使用正确的语言或工具可能会增加工作量,但从长远来看,花额外的时间是值得的。 请记住,比起采取捷径而不得不回过头来纠正最初错过的漏洞,花更多的时间来第一次做正确的工作要好。

4)如果被卡住,请休息一下 (4) If You Get Stuck, Take a Break)

Everyone has those moments when you get so frustrated with coding you start yelling and blaming your troubles on your computer. If or when this happens, take a step back from your computer and do something to take your mind off coding. Perhaps a bathroom break or a walk around the block will be sufficient. But often it’s better to work on another project or take a half hour break from work completely and do something relaxing. Once you feel refreshed and energized, take another stab at the code.

当您对编码感到沮丧时,每个人都会遇到这些时刻,您开始大吼大叫并将麻烦归咎于计算机。 如果发生这种情况,请从计算机后退一步,并采取一些措施使您不必担心编码。 也许洗手间或在街区漫步就足够了。 但是通常最好是进行另一个项目,或者完全休息半小时并放松一下。 一旦感到精神焕发和精力充沛,请再次尝试一下代码。

5)保持方法的可维护性 (5) Keep Methods Maintainable)

Complicated monster methods are a common error seen among novice programmers. To save time and headaches, limit your methods to a manageable size making your code easier and quicker to read and maintain. When you have lengthy methods, break it up into smaller descriptive components, each portion representing a well-abstracted action. If you don’t do this proactively, the monster method will win. With maintainable methods, not only will the code be more readable, it makes debugging the code simpler and less time consuming.

复杂的怪物方法是新手程序员常见的错误。 为了节省时间和麻烦,将您的方法限制在可管理的范围内,使您的代码更易于阅读和维护。 如果有冗长的方法,请将其分解为较小的描述性组成部分,每个部分都代表一个抽象的动作。 如果您不主动执行此操作,monster方法将获胜。 使用可维护的方法,不仅使代码更具可读性,而且使调试代码更简单且耗时更少。

6)英文代码 (6) Code in English)

Using English as your main coding language will simplify everything. English has become the universal language of code. To improve the usability and versatility of your code, you must use a language all programmers can read and understand. Having a universal language facilitates efficiency, readability and commonality as well as, it allows programmers to connect internationally with one another and share their codes easily without need for translation.

使用英语作为主要的编码语言将简化一切。 英语已经成为代码的通用语言。 为了提高代码的可用性和多功能性,必须使用所有程序员都可以阅读和理解的语言。 拥有一种通用的语言不仅可以提高效率,可读性和通用性,还可以使程序员在国际上相互联系,并轻松共享其代码而无需翻译。

Although some of these tips may seem tedious or time consuming now, once you incorporate them into your daily coding routine, you we quickly see enhanced work performance and efficiently throughout your daily tasks.

尽管现在这些技巧中的一些看起来似乎很乏味或很耗时,但是一旦将它们纳入日常编码例程中,您就会很快看到在整个日常任务中工作性能得到了有效提高。

翻译自: https://medium.com/swlh/6-hacks-to-make-a-programmers-life-easier-a17bdd0c1c91

程序员沟通技巧

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_26705651/article/details/108946014

智能推荐

接口库测试使用问题记录-程序员宅基地

文章浏览阅读79次。为什么80%的码农都做不了架构师?>>> ..._confreportcontrol max

【cocos creator】编辑器里运行脚本代码_cocoscreator resetineditor-程序员宅基地

文章浏览阅读1.8k次。多看官方代码creator.ts有相关注释,使用方法1、编辑器里运行脚本代码protected resetInEditor(): void;用来初始化组件或节点的一些属性,当该组件被第一次添加到节点上或用户点击了它的 Reset 菜单时调用。这个回调只会在编辑器下调用。将脚本写在此函数下,会在脚本挂到节点上执行resetInEditor(){ this.node.addComponent(cc.Label);}2、在编辑器添加组件中展示自定义脚本ts:/**将Label字体转为加粗_cocoscreator resetineditor

用python画简单的图形_python代码简单图形-程序员宅基地

文章浏览阅读1.9w次,点赞10次,收藏51次。用python画几个简单的图形:①三角形from turtle import *for i in range(3): fd(180)left(120)②倒三角+正三角from turtle import*fd(60)right(120)fd(120)right(120)fd(120)right(120)fd(60)..._python代码简单图形

自然语言处理期末复习(3)-(5)模型与句法分析_eisner算法-程序员宅基地

文章浏览阅读2.3k次。第三部分 隐马尔科夫模型与词类标注1.定义:如果给定一个观察序列(不同颜色的小球序列),不能直接确定状态转换序列(坛子的序列),因为状态转移过程被隐藏起来了。所以这类随机过程被称为隐马尔科夫过程。 2.词类标注的方法:(1)基于规则的词类标注:查字典,给词标记所有可能,逐步删除错误的可能(2)基于隐马尔科夫模型的词类标注:词代表小球,标注代表坛子,相当于给了小球,求坛子(3)改进隐马尔科夫模型:b..._eisner算法

网络设备驱动基本原理和框架_网络驱动 原理-程序员宅基地

文章浏览阅读2k次。一、协议栈层次对比二.Linux网络子系统 Linux网络子系统的顶部是系统调用接口层。它为用户空间提供的应用程序提供了一种访问内核网络子系统的方法(socket)。位于其下面是一个协议无关层,它提供一种通用的方法来使用传输层协议。然后是具体协议的实现,在Linux中包括内核的协议TCP,UDP,当然还有IP。然后是设备无关层,它提供了协议与设备驱动通信的通用接口,最下面是设_网络驱动 原理

防火墙测试-思博伦Avalanche 3100_双极未来_avalanche客户端指定协议号-程序员宅基地

文章浏览阅读1.1k次。1. 测试内容与目的 本次测试旨在了解 A、B 两款防火墙实际参数与标称参数的差异,主要测试吞吐量、并发、每秒新建连接数等防火墙的基础性能。 2. 测试拓扑与数据流 使用思博伦 Avalanche 3100 测试仪,模拟客户端和服务器。客户端(1 台 Avalanche3100 模拟)发起 HTTP 事务请求,经过防火墙后,数据包被发给服务器(1台 Avalanche 31..._avalanche客户端指定协议号

随便推点

三层架构之泛型抽象工厂-程序员宅基地

文章浏览阅读69次。原来写过一篇三层架构之泛型应用的简单登录,已经过去2年了,今天有一朋友问我关于抽象工厂的问题,就把自己后来解耦的方法从项目中拿出来了,方便大家学习。我重新写了一个例子项目,如下截图:XU.Model层中有一个抽象类BaseModel.cs,User.cs是用户实体类,继承与BaseModel类,是用于类型安全考虑的1 using System;2 3 na...

Linux下卸载openjdk,安装jdk_openjdk java runtime environment 1.6.0-程序员宅基地

文章浏览阅读368次。先检查Linux是否自带openJDK通过java -version查看版本,若无任何输出,则直接安装对应版本JDK [root@uuu /]# java -version java version "1.6.0" OpenJDK Runtime Environment (build 1.6.0-b09) OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode) 2.查看ja..._openjdk java runtime environment 1.6.0

Redhat7.5升级openssh到8.2p1_redhat7.5默认ssh版本-程序员宅基地

文章浏览阅读1.7k次。最近公司有需求将redhat的openssh升级到新版本(7.4p1 -> 8.2p1),经过近一周时间的努力,终于初步完成了这个工作,在此做记录已供后续回查。零、引用连接 https://www.jianshu.com/p/e75300b7e8be参考文献,虽然步骤有点乱但是也算是有用 https://help.aliyun.com/knowledge_detail/..._redhat7.5默认ssh版本

芯片和计算机专业的关系,cpu是芯片吗?芯片和cpu是什么关系?-程序员宅基地

文章浏览阅读4k次。对于cpu和芯片的问题,很多朋友搞不清楚它们的不同,有的认为cpu就是芯片,那么cpu是芯片吗?芯片和cpu有什么不同?它们的关系如何呢?今天就给大家具体介绍下这些问题,以供参考。cpu是芯片吗?CPU就是芯片,是作为计算机系统的运算和控制核心,是信息处理、程序运行的最终执行单元。CPU一般由逻辑运算单元、控制单元和存储单元组成。在逻辑运算和控制单元中包括一些寄存器,这些寄存器用于CPU在处理数据..._芯片和计算机有什么关系

json-c序列化的使用_json_object_new_object-程序员宅基地

文章浏览阅读1.3k次,点赞2次,收藏9次。json是什么及json的一些实例json 是一种轻量级的数据交换格式。易于人阅读和编写。同时也易于机器的解析和生成。json的实例是键值对的形式,可以类比于c++的map{"name":"Jack","sex":"man"} {"name":"Jack","age":18,"address":{"country":"china","zip-code":"10000"}} //数字可以不加双引号 {"a":1,"b":[1,2,3]} //数组类型json-c库API的使用..._json_object_new_object

du command-程序员宅基地

文章浏览阅读1k次。du(disk usage)命令用于查看指定的目录或文件所占用的磁盘空间。_du command