What is Code Quality?
Ref detail : https://realpython.com/python-code-quality/
What is Code Quality?
Of course you want quality code, who wouldn’t? But to improve code quality, we have to define what it is.
A quick Google search yields many results defining code quality. As it turns out, the term can mean many different things to people.
One way of trying to define code quality is to look at one end of the spectrum: high-quality code. Hopefully, you can agree on the following high-quality code identifiers:
- It does what it is supposed to do.
- It does not contain defects or problems.
- It is easy to read, maintain, and extend.
These three identifiers, while simplistic, seem to be generally agreed upon. In an effort to expand these ideas further, let’s delve into why each one matters in the realm of software.
Why Does Code Quality Matter?
To determine why high-quality code is important, let’s revisit those identifiers. We’ll see what happens when code doesn’t meet them.
It does not do what it is supposed to do
Meeting requirements is the basis of any product, software or otherwise. We make software to do something. If in the end, it doesn’t do it… well it’s definitely not high quality. If it doesn’t meet basic requirements, it’s hard to even call it low quality.
It does contain defects and problems
If something you’re using has issues or causes you problems, you probably wouldn’t call it high-quality. In fact, if it’s bad enough, you may stop using it altogether.
For the sake of not using software as an example, let’s say your vacuum works great on regular carpet. It cleans up all the dust and cat hair. One fateful night the cat knocks over a plant, spilling dirt everywhere. When you try to use the vacuum to clean the pile of dirt, it breaks, spewing the dirt everywhere.
While the vacuum worked under some circumstances, it didn’t efficiently handle the occasional extra load. Thus, you wouldn’t call it a high-quality vacuum cleaner.
That is a problem we want to avoid in our code. If things break on edge cases and defects cause unwanted behavior, we don’t have a high-quality product.
It is difficult to read, maintain, or extend
Imagine this: a customer requests a new feature. The person who wrote the original code is gone. The person who has replaced them now has to make sense of the code that’s already there. That person is you.
If the code is easy to comprehend, you’ll be able to analyze the problem and come up with a solution much quicker. If the code is complex and convoluted, you’ll probably take longer and possibly make some wrong assumptions.
It’s also nice if it’s easy to add the new feature without disrupting previous features. If the code is not easy to extend, your new feature could break other things.
No one wants to be in the position where they have to read, maintain, or extend low-quality code. It means more headaches and more work for everyone.
It’s bad enough that you have to deal with low-quality code, but don’t put someone else in the same situation. You can improve the quality of code that you write.
If you work with a team of developers, you can start putting into place methods to ensure better overall code quality. Assuming that you have their support, of course. You may have to win some people over (feel free to send them this article
What is Code Quality?的更多相关文章
- Code Quality
Code Quality https://www.sonarqube.org/ java https://www.sonarsource.com/products/codeanalyzers/sona ...
- WebGoat系列实验Buffer Overflows & Code Quality & Concurrency
WebGoat系列实验Buffer Overflows & Code Quality & Concurrency Off-by-One Overflows 实验需要访问OWASP Ho ...
- jshint-eclipse: JavaScript Code Quality Plugin for Eclipse
https://blog.oio.de/2012/03/26/jshint-eclipse-javascript-code-quality-plugin-for-eclipse/ techscou ...
- [Reproduced] How to Improve Code Quality?
How to Improve Code Quality? Ref: https://www.perforce.com/blog/sca/what-code-quality-and-how-improv ...
- Code Quality and Security | SonarQube
SonarQube - 国内版 Binghttps://cn.bing.com/search?FORM=U227DF&PC=U227&q=SonarQube Code Quality ...
- 说说怎么写clean code
前两天参加了公司组织的一个培训,主题是“如何写出好的代码” ,刚看到这个主题,第一反应是又不知道是哪个培训机构来忽悠钱的!老大安排了,就去听听呗. 说实在的,课程内容没有什么新鲜的东西,就是讲讲如何发 ...
- Peer Code Reviews Made Easy with Eclipse Plug-In
欢迎关注我的社交账号: 博客园地址: http://www.cnblogs.com/jiangxinnju/p/4781259.html GitHub地址: https://github.com/ji ...
- Code Understanding Step by Step - We Need a Task
Code understanding is a task we are always doing, though we are not even aware that we're doing it ...
- Quality in the Test Automation Review Process and Design Review Template
About this document Prerequisite knowledge/experience: Software Testing, Test Automation Applicable ...
随机推荐
- docker load tar.gz包失败解决方法
执行docker load -i xxx.tar.gz时候报错 open /var/lib/docker/xxx No such file or directory 这种情况属于容器快照文件缺乏基础镜 ...
- 为Endnote中的期刊名称添加缩写期刊名
为Endnote中的期刊名称添加缩写期刊名 Endnote - tools - Open term lists - Journals term lists - lists -- Journals - ...
- qsort与sort
快排是我们平常敲代码和比赛的时候 经常使用到的方法 qsort是函数库中自带的函数 这是一个标准的快排函数 而sort比qsort更是好用 sort对于不同大小的数组 会使用不 ...
- 编译器的系统include路径查询
环境:Ubuntu 18.04.3 LTS 以 aarch64-linux-gnu-gcc 为例,运行如下命令: echo "main(){}" | aarch64-linux-g ...
- java字符串截取
import org.apache.commons.lang.StringUtils; public class substr{ public static void main(String[] ar ...
- WEUI Search Input回车键无法跳转解决
现象:回车键依然当前页面, window.location.href 设置无法起作用 增加 window.event.returnValue = false; 解决问题
- LeetCode 5073. 进击的骑士(Java)BFS
题目:5073. 进击的骑士 一个坐标可以从 -infinity 延伸到 +infinity 的 无限大的 棋盘上,你的 骑士 驻扎在坐标为 [0, 0] 的方格里. 骑士的走法和中国象棋中的马相似, ...
- 下载并使用MNIST数据集
TensorFlow提供了一个库,可以直接用来自动下载与安装MNIST. MNIST里包含3个数据集:第一个是训练数据集(mnist.train.images),另外两个分别是测试数据集(mnist. ...
- Java Annontation 注解的学习和理解
/** * <html> * <body> * <P> Copyright 1994 JsonInternational</p> * <p> ...
- 【高并发解决方案】8、Nginx/LVS/HAProxy负载均衡软件的优缺点详解
PS:Nginx/LVS/HAProxy是目前使用最广泛的三种负载均衡软件,本人都在多个项目中实施过,参考了一些资料,结合自己的一些使用经验,总结一下. 一般对负载均衡的使用是随着网站规模的提升根据不 ...