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?的更多相关文章

  1. Code Quality

    Code Quality https://www.sonarqube.org/ java https://www.sonarsource.com/products/codeanalyzers/sona ...

  2. WebGoat系列实验Buffer Overflows & Code Quality & Concurrency

    WebGoat系列实验Buffer Overflows & Code Quality & Concurrency Off-by-One Overflows 实验需要访问OWASP Ho ...

  3. jshint-eclipse: JavaScript Code Quality Plugin for Eclipse

    https://blog.oio.de/2012/03/26/jshint-eclipse-javascript-code-quality-plugin-for-eclipse/   techscou ...

  4. [Reproduced] How to Improve Code Quality?

    How to Improve Code Quality? Ref: https://www.perforce.com/blog/sca/what-code-quality-and-how-improv ...

  5. Code Quality and Security | SonarQube

    SonarQube - 国内版 Binghttps://cn.bing.com/search?FORM=U227DF&PC=U227&q=SonarQube Code Quality ...

  6. 说说怎么写clean code

    前两天参加了公司组织的一个培训,主题是“如何写出好的代码” ,刚看到这个主题,第一反应是又不知道是哪个培训机构来忽悠钱的!老大安排了,就去听听呗. 说实在的,课程内容没有什么新鲜的东西,就是讲讲如何发 ...

  7. Peer Code Reviews Made Easy with Eclipse Plug-In

    欢迎关注我的社交账号: 博客园地址: http://www.cnblogs.com/jiangxinnju/p/4781259.html GitHub地址: https://github.com/ji ...

  8. 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 ...

  9. Quality in the Test Automation Review Process and Design Review Template

    About this document Prerequisite knowledge/experience: Software Testing, Test Automation Applicable ...

随机推荐

  1. jsp标签${fn:contains()}遇到问题记录

    在jsp页面要实现这样一个功能,列表的某一列字段要显示的数据,是从后台的一个列表中获取的,数据库里面该列存储的方式是 类似 1,2,3 这样的 主键id数据.显示的时候要根据id显示名称,如果是多个 ...

  2. IBM X3650 M4 M5 设置服务器用UEFI模式启动支持磁盘GPT分区

    1 系统启动 2 按 F1 3 进入BIOS 4 进入 System Configuration 5 找到 Boot Manager 6 找到Boot Modes 7 进入Boot Modes, 找到 ...

  3. 使用vue搭建应用四引入axios

    Axios 是一个基于 promise 的 HTTP 库,可以用在浏览器和 node.js 中 特性 从浏览器中创建 XMLHttpRequests 从 node.js 创建 http 请求 支持 P ...

  4. 如何录制高清GIF格式的图片

    如何录制高清GIF格式的图片 工具:傲软GIF 下载地址:https://www.apowersoft.cn/gif 特点:质量高,能够一帧一帧的修改 使用简单.就不说了.自行尝试.这里只是提供一个制 ...

  5. 手撕面试官系列(三):微服务架构Dubbo+Spring Boot+Spring Cloud

    文章首发于今日头条:https://www.toutiao.com/i6712696637623370248/ 直接进入主题 Dubbo (答案领取方式见侧边栏) Dubbo 中 中 zookeepe ...

  6. c++项目经验分享

    1.C++的const比C语言#define更好的原因? 首先,它能够明确指定类型,有类型检查功能. 其次,可以使用C++的作用域规则将定义限制在特定的函数[常函数]或文件中. 第三,可以将const ...

  7. PHP中YUM的理解

    1. YUM是什么? 1)全称:Yellow dog Updater ,Modified. 2)百度简述:是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器.基于RPM包 ...

  8. 【MySQL】各种小坑-持续更新

    中文乱码问题 在建表的时候额外执行 ALTER TABLE camera CONVERT TO CHARACTER SET utf8; 如果还是不行注意看一下precision,为2的时候容易出现?? ...

  9. 在Go中简单实现HTTP服务中间件

    通常一个简单http服务框架,就是注册一堆路由,然后根据路由调用不同的逻辑去处理. 但实际上可能有一些统一的处理对几乎所有的路由都涉及到,比如日志,比如权限等等. 那么这个时候搞一个中间做预处理,是一 ...

  10. unity---为什么用Time.deltaTime * speed 表示每秒移动的距离的理解

    Time.deltaTime:代表时间增量,即从上一帧到当前帧消耗的时间, 这个值是动态变化的. dt 表示 deltaTime. 假如 1s渲染10帧,沿X轴方向的移动速度 speed = 10m/ ...