In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
The main content of this article is to explain "what is the simplicity of Js code?" interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the simplicity of Js code?"
The software engineering principles mentioned by RobertC.Martin in "Code cleanliness" {: target= "_ blank"} also apply to JavaScript. This is not a style reference. It instructs how to write readable, reusable and reconfigurable software in JavaScript.
What does cleanliness of code require?
Not every principle must be strictly followed, or even rarely recognized by everyone. They are for reference only, but you should know that these principles are the collective experience accumulated by the authors of "the way to Code cleanliness" over the years.
We have just over 50 years of technological development in software engineering, and we are still learning a lot. When software architecture is as old as architecture itself, we should follow stricter rules. Now, use these guidelines to evaluate the quality of JavaScript code written by you and your team.
One more thing: knowing this won't make you a better software developer right away, and using these guidelines for years at work won't help you avoid mistakes. Each piece of code starts from the initial sketch to the final shape, just like shaping wet clay. Finally, when we review it with our peers, we eliminate the imperfections. Don't deny yourself because the first draft needs to be improved, it's just the code that needs to be negated!
Variables of clean and tidy code
Use a variable name with an exact meaning
Bad:
Varyyyymmdstr=moment () .format ('YYYY/MM/DD')
Good:
VaryearMonthDay=moment () .format ('YYYY/MM/DD')
Use the constant of ES6 when the value of the variable does not change
In bad cases, variables can be changed. If you declare a constant, it will remain the same throughout the program.
Bad:
VarFIRST_US_PRESIDENT= "GeorgeWashington"
Good:
ConstFIRST_US_PRESIDENT= "GeorgeWashington"
Use the same vocabulary for variables of the same type
Bad:
GetUserInfo (); getClientData (); getCustomerRecord ()
Good:
GetUser ()
Use a searchable name
The code we read is always cheaper than what we write. It is important to write code that is readable and easy to retrieve. The use of meaningless variable names in a program can be difficult to understand and hurt the reader. Therefore, the name is defined as searchable.
At this point, I believe you have a deeper understanding of "what is the simplicity of Js code?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.