In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, Xiaobian will bring you naming rules about how to analyze. NET Chinese variables and methods. The article is rich in content and analyzes and narrates from a professional perspective. After reading this article, I hope you can gain something.
We will introduce. NET Chinese variable and method naming rules, believe that through the standard. NET Chinese variable and method naming, can make future maintenance and development work more simple, but also convenient reuse.
Currently, we use. NET Chinese variables in our projects, from rights management 3 years ago, to shopping cart management a year ago, to class libraries (membership bonus rules). I realized the great convenience of Chinese variables for project maintenance.
Premise: The development team mainly uses Chinese, the development documents mainly use Chinese, the business maintenance of the system mainly uses Chinese, and the development environment mainly uses Chinese. The deployment environment does not matter. If the deployment environment is not Chinese, test it in advance in the deployment environment. Recommended, *** Development and deployment environments are the same. In order to improve the efficiency of the project.
Naming rules for variables: For example: private float c1_shopping cart_total amount of non-exchanged goods = 0; form: (English or Pinyin) letter prefix + number + underscore + Chinese name of letter prefix + underscore + name of variable;(English cart) c1_shopping cart_total amount of non-exchanged goods here: 1 represents member variable in class, it is suggested that letter prefix be lowercase 2 to represent method in class, and letter prefix be capitalized 3 to represent local variable in method; It is recommended that letters be prefixed with lowercase for enumeration types without numbers, such as:
private void C2_Cart () {...} private void C2_Cart () { string c3_Cart ID = WebUtils.GetShoppingCartId(); } public enum OrderStateEnum { os_Order Status_Pending Orders =1, os_Order Status_Paid Orders = 2, os_Order Status_Received Orders = 3, os_Order Status_Shipped Orders = 4, os_Order Status_Received Orders = 5, os_Order Status_Completed Order = 6 } public bool PB2_Bonus Points_Join Bonus Points Pool (int orderid) { ... bool pb3_Bonus Points_Join Bonus PoolSuccess = true;... pb3_Bonus_Order Details.UO_state = (int)b2cCityBLL.OrderStateEnum.os_Order Status_Completed Order; new b2cCityBLL.OrderBLL().UpdateOrder(pb1_Bonus_Order Details);... return pb3_Bonus Points_Join Bonus Points Pool is successful; }
Here pb stands for PointsBonus, and most of our use of prefixes is in English. The number of characters in the prefix is generally no more than three. Because they are distributed in different namespaces, they are not duplicated. Moreover, their rules apply simply as *** to satisfy 90% of our website projects. The other 10 percent, generally speaking, is not where we are primarily. 70% of our energy is spent on maintenance of future projects, not development. That is to say, maintenance projects are the main ones (70%), and new projects are developed as a supplement (30%). In this way, the reuse rate of our project function modules is very high, and the corresponding development efficiency is also improved.
In this way, you can get ide's intelligent prompt function through prefix, and related variables will be sorted together; Chinese names should be communicated with salesmen to obtain consensus.
Disadvantages, mainly Chinese input there are certain problems, but for the benefits of the whole project, can be ignored.
The above is how to analyze the naming rules of. NET Chinese variables and methods shared by Xiaobian for everyone. If you happen to have similar doubts, you may wish to refer to the above analysis for understanding. If you want to know more about it, please pay attention to the industry information channel.
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.