Coding Guidelines - Code Quality & its Importance in Software Development

in #technology2 years ago

One of the topics that i want do discuss and write some content today is about the importance that coding standards have when developing app and softwares.

Before mentioning some of the Best Practices and Legendary Coding Guidelines, it is good to mention why Coding Standards are important?

Why Coding Standards are important?

  • Coding Standards are important because the use of them has a great benefit on the product delivery and development process.
  • Not using Coding Standards will results in writing code which will not be so understandable for other developers, causing them to spent more time trying to understand that code, which is not a good for the benefit of the team
  • By not using Coding Standards, developers can write the code in their way of thinking, which some times is not according to security compliance and standards.
  • By not using Coding Guidelines, developers can write code which at first can look as performant but when the software gets bigger, it will result in the performance issues.
  • Code Quality can impact the overall platform (app, software) quality. Bad Code -> Bad Software Quality | Good Code -> Good Software Quality

Tool Suggestions

There are a lot of tools in which you can set and defined the rules that you want your team to follow. The tools depends on the programming language your team is working on and some time the editor.

  • If you are a Javascript developer (React JS, React Native, JSX, VueJS, NodeJs etc..) some tool suggestions for you are: ESLint, JSHint , Prettier
    Example of ESLint rules
"rules": {
    "no-unused-vars": "off",
    "no-undef": "off",
    "max-len": ["error", {"code": 150}],
    "prefer-promise-reject-errors": "off",
    "react/prop-types": "off",
    "react/display-name": "off",
    "react/jsx-key": "off",
}

And then there are some rules and guidelines for any kind of development, not language related that any top developer should consider implementing them into their code

pankajpatel1IW4HQuauSUunsplash.jpg

Photo by Pankaj Patel on Unsplash

Best Practices/Coding Guidelines

  • Analyse the Code before pushing it to Code Review
  • Follow Name Conventions for local and global variables, for Functions, Classes, Array and Object Definitions
  • Use Indentation - The code should be easier to read, also it would enjoyable to watch (Indentation by 2-spaces is highly recommended)
  • Convert a piece a code used multiple times into a Function
  • Reusable Code
  • Better Error Handling
  • Comment your code (Functions, Classes, Variable Definitions) -> helps other developers who might work into your code to better understand what that function or class does.
  • Write Better Commit Messages
  • Don't leave a lot of unnecessary spaces
  • Use Validation when needed
  • Leave the logic to the part of code that can handled it.
  • Write Tests (Acceptance and Other Tests)
  • Log Errors properly, you will need them maybe in the future
  • Write Documentation
  • Lot more

For Javascript one of the best Coding Guidelines and Practice i would suggest and highly recommend is: Airbnb Javascript Style Guide (https://github.com/airbnb/javascript)

They have set higher standards and are one of the largest contributors for a Better Approach to Javascript.

Hope you enjoy it. Feel free to add any suggestions.

Gianni

Sort:  

Yay!
Your post has been boosted with ESTM. Keep up the good work!
Dear reader, Install Android, iOS Mobile app or Windows, Mac, Linux Surfer app!
Learn more: https://esteem.app
Join our discord: https://discord.me/esteem

:)

Good