Coding standarts - ybouz2/project-tech GitHub Wiki

Think of coding standards as a set of rules, techniques, and best practices to create cleaner, more readable, more efficient code with minimal errors. They offer a uniform format by which software engineers can use to build sophisticated and highly functional code.

Important standarts

Choose industry-specific coding standards

"Coding best practices and standards vary depending on the industry a specific product is being built for. The standards required for coding software for luxury automobiles will differ from those for coding software for gaming." - BroweserStack

Naming conventions

Naming Conventions

This is the name you give to packages, classes, functions and more. You can do this in different ways. Since day 1 on CMD we learned to use camleCase this is a easy way to give names to those functions. classes etc.

File structure & Naming

This is something that is going to help you, if you give your css files good names it can save a lot of time. You can see in a glimp where it is going about and what could possibly be in it. Consistency matters. Like navigating around the house, itโ€™s nice to know where everything is and that items are placed in a logical order. The time invested in learning how to organize your code now will help you streamline future projects and add consistency between projects.

Commenting and documenting

Commenting

Commenting on what a function does is very useful for an outsider who looks at your code. It can also be a reminder to yourself so that you don't have to remember what your function or something else does. Remove the useless comments and console.log() which is 'dead code'.

Classes and functions

You give each function a name, to keep an overview of which function does what, you give it a name that briefly describes what the function is for. You also do this if you give a div a class, for example. Then you give it, for example, a .container so that you know that it is a container that contains a number of other lines of code.


sources: