Change - Why we need coding standards
Change - Why we need coding standards
I have the idea of coding standards when I have to review my team’s code. I found it's painful to review others' code, for there was no official coding standards that time. Somebody may say, though we don't have a coding standard, most parts are the same. How most it is? We don't know, and they didn't need to do code review that time.
After I worked for an outsourcing company, I found strict coding standards were surprisingly effective and useful. Nowadays, I believe every programmer is sure that coding standards are useful. Don't say that before I tell you what the coding standards is. Give you a simple demo:

How about this time?
At our company, we could look at any piece of code, anywhere in msstash, and we could read it. Could you easy to look at a piece of unfamiliar code and understand it? You will found that it’s awful to read other teams’ code, even other people’s code in your team. But why, do you think of that?
Do you have the standardization of style - indents, names, file structures, and comment conventions, for yourself, your team, and your company?
After I read MarkCC’s article about coding standards, I think it covered most of the reason why people don’t like it.
There's a suite of common objections to this, codify and simplify as below.
It wastes time!
I'm a good coder, and I don't want to waste time on stupidity. I'm good enough that when I write code, it's clear and easy to understand. Why should I waste my time on some stupid standard?
I'm an artist!
This is phrased facetiously, but it does reflect a common complaint. We programmers have a lot of pride in our personal style. The code that I write really does reflect something about me and how my mind works. It's a reflection of my skill and my creativity. If I'm forced into some stupid standard, it seems like it's stifling my creativity.
One size fits all actually fits none!
If you have a coding standard that wasn't designed specifically for your project, then it's probably non-optimal for your project. That's fine. Again, it's just syntax: non-optimal doesn't mean bad.
I'm too good for that!
This is actually the most common objection. It's sort-of a combination of the others, but it gets at an underlying attitude in a direct way. This is the belief on the part of the complainer that they're a better programmer than whoever wrote the standard, and lowering themselves to following the standard written by the inferior author will reduce the quality of the code.
When you're coding against a standard, there are inevitably going to be places where you disagree with the standard. There will be places where your personal style is better than the standard. But that doesn't matter. As long as the standard isn't totally ridiculous, the comprehension benefits are significant enough to more than compensate for that.
But what if the coding standard is totally ridiculous?
Well, then, it's rough to be you: you're screwed. But that's not really because of the ridiculous coding standard. It's because you're working for idiots. But it won’t happen in our company.
Many questions we may meet:
- Our team has coding standards, it’s enough.
Coding standards could be personal, team, department, company, industry. The higher the better and the best is company level. It makes easy to read code crossing teams and share.
- I know what the code meaning.
Code is not for you. At least it is for your team.
In an agile team, we should conduct code review, pair programming, etc. All these must base on coding standards. I guess no one wants to review the code if it’s not your style, much more maintain it. Buy why it’s your style, only when your style is equal to the company style.
Change - Why we need coding standards的更多相关文章
- C# Coding Conventions, Coding Standards & Best Practices
C# Coding Conventions, Coding Standards & Best Practices Cui, Chikun Overview Introduction This ...
- linux c coding style
Linux kernel coding style This is a short document describing the preferred coding style for the lin ...
- [中英对照]Linux kernel coding style | Linux内核编码风格
Linux kernel coding style | Linux内核编码风格 This is a short document describing the preferred coding sty ...
- coding规约的网站, 从sonar中链接过去
一个coding规约的网站, 从sonar中链接过去的. 挺好. https://wiki.sei.cmu.edu/confluence/display/seccode/SEI+CERT+Coding ...
- 16/7/8_PHP-书写规范 PHP Coding Standard
变量命名规范这里感觉 打算采用 匈牙利命名法+驼峰法命名,因为 PHP是弱类型语言,很多时间因为忽略了变量类型而导致犯一些低级错误.所以在前面加上类型名有助于更好的理解代码. 下载是转载 PHP书写规 ...
- a* products
Experience of black-box testing on set-top-boxes/IP-connected devices, games consoles and tablets ht ...
- php.ini
[PHP];;;;;;;;;;;;;;;;;;;; About php.ini ;;;;;;;;;;;;;;;;;;;;; PHP's initialization file, generally ...
- PHP配置详解
[PHP] ;;;;;;;;;;;;;;;;;;; ; About php.ini ; ;;;;;;;;;;;;;;;;;;; ; This file controls many aspects of ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
随机推荐
- 爬虫开发14.scrapy框架之分布式操作
分布式爬虫 一.redis简单回顾 1.启动redis: mac/linux: redis-server redis.conf windows: redis-server.exe redis-wi ...
- 微信小程序遇到的问题与解决
1.微信开发工具报错 400 (Bad Request) 解决方法: 注:因为开发工具升级 content-type的写法变了 如下代码: header:{ "Content-Typ ...
- php面向对象编程_2
1, 抽象类 ,用abstract关键字来修饰一个类,这个类就是抽象类:如果用abstract关键字来修饰一个方法,这个方法就是抽象方法,如果是抽象方法就不能实现(即抽象方法只能声明,不能定义). 抽 ...
- 7,CountDownLatch 与 CyclicBarrier 的 区别
CountDownLatch : 一个同步辅助类,在完成一组正在其他线程中执行的操作之前,它允许一个或多个线程一直等待. 用给定的计数 初始化 CountDownLatch.由于调用了 countDo ...
- 制作基于centos可以ssh连接的容器以及tomcat容器
可以ssh连接的centos容器 参考:http://blog.csdn.net/mexel310/article/details/51705777 一. pull好镜像后,运行容器 1. docke ...
- 游戏1:HTML5制作网页游戏围住神经猫--createjs
游戏简介:点击小圆圈,是蓝色的小圆圈不跑出圆圈外,跑出则结束游戏 准备工作: 下载easejs :下载地址:http://www.createjs.cc/easeljs 中文网站 效果: in ...
- SpringMVC的JSP页面中中EL表达式不起作用的问题解决
原文地址:https://blog.csdn.net/sinat_35512245/article/details/53611663
- UltraFast设计法实践(1) -- 初始设计检查
目录 1. report_failfast 1.1 命令使用 1.2 优化 1.3.总结 2.report_timing_summary 3. report_methodology 4. 总结 5.遗 ...
- python高级(三)—— 字典和集合(泛映射类型)
本文主要内容 可散列类型 泛映射类型 字典 (1)字典推导式 (2)处理不存在的键 (3)字典的变种 集合 映射的再讨论 python高级——目录 文中代码均放在github上:https://git ...
- git克隆和上传项目
软件环境: 1. VS2017 2. Git ver 2.17.0.1 3. gitee.com 目的: 已有的本地项目(新建)上传到码云,使本地可以和码云同步 尝试: 先在码云上建立项目,项目名称和 ...