My Programming Specification - Name

zhaozj2021-02-16  49

1. Naming specification prepared by the program 1. The constant name constant name is under the uppercase letters, and the words are underlined. Example: public final static string config_name = "config"; 2. Class name class name with noun. The first letter is uppercase. Example: Public class userManager {} // userManager is "Heightcamel", like a camel, UserManager is a noun, and Manageuser is not a verb. 3. Function name function name verb and use "LowerCamel". Example: Public void management () {} If Manageuser is "LowerCamel", and is a verb. 4. Parameter name parameter name is "LowerCamel". Example: Public void getfirstname (String MyName) // myName is the properties name of "LowerCamel" 5. Class's attribute (or domain) class class, underscore letters (_xxaxx), also observe "LowerCamel". Example: private string _name; private string _myphonenumber; 6. Function Internal variable name function Internal variable name Normal Use "LowerCamel" Example: Public void Manageuser () {String SQL = "Update Users set ...."; statement sqlState =. ....; 7. 7. SQL statement SQL statement keyword should be capitalized. Example: SQL = "SELECT * from users where birthday like ....";

8. Boolean is a function name as a return value When the function returns a Boolean type, the function name begins with the "IS" start or "check", but do not use two together. Either use "IS", either all "Check". Example: public boolean isvaliduser (int userid) {} ​​or public boolean checkvaliDuser (int userid) {}

Note: It is recommended to use "IS" to start, it is more clear! Such as: if isvaliDuser (i) {}

Second, about the database named database name and data table name and field name or domain name use lowercase, separated by "_" Underline Separation Singleword: Users Name User_ID Field Name

转载请注明原文地址:https://www.9cbs.com/read-20576.html

New Post(0)