Coding Standard Brings Programers Convenience

10 Feb 2021

Programming style refers to the types of rules for writing code. Different programmers often have different programming styles. Some people explain it as the part that ignored by the compiler is called “programming style.” The compiler’s specification is called “grammar”, which must be followed by programmers; and the part they ignored is free for programmers to choose. This statement is not entirely correct. Programmers are free to choose a programming style, but a good programming style helps to write programs with higher quality, fewer errors, and easier maintenance.

JavaScript, which I think is a magical language, gives us flexibility while it also lays some holes. For example, the meaning of “==” or “this” are confusing. The Lint tool solves this problem very well. It simply prohibits you from using ==. Although this approach limits the flexibility of the language, it brought considerable benefits. For example, ESLint, one of many JavaScript Linters, can freely choose which rules to use. There are also many ready-made plugins that can be used, and its support for ES6 and JSX is also higher than other linters. Because the focus was on technology and there are relatively fewer developers, so the ESLint is rarely used by small teams which makes the communication more convenient. But when working in large teams, the standards of a good code are particularly important, because this is one of the ways to ensure that the team has the same code style and avoid mistakes.

Therefore, one point should be clear. The choice of “programming style” should not be based on personal hobbies, familiarity, typing workload and other factors, but should consider how to make the code as clear and easy to read as possible to reduce errors. What you choose should not be a style you like, but a style that can clearly express your intentions. This is especially important for languages with a high degree of grammatical freedom, but a design is not fully mature, such as JavaScript.