Naming standard, only a collection suitable for their own naming conventions!

HTML in JS function named:

function set_color(){     }

function Set_Color(){     }

 

HTML in JS variable name:

var MENU_MAX_ID = 1] [Global Variables

var menu_current_item = 3] [local variables

 

HTML CSS in name

(Remember: 1, all lower case 2, in addition to other places do not use CSS underlined -, other code places with an underscore _):

.masjt-side-menu{font-size: 16px;margin-bottom: 51px;}

 

ASP, PHP the function name:

sub setColor(){       }

function GetColor(){      }

 

ASP, PHP variable names in common:

var MENU_MAX_ID = 1 [so] the global variable * Recommended

var p_menu_current_item = 3 [recommend this local variables *]

var p_NavColor = 3] [local variables

var pMenuColor = 3] [local variables

 

The file name of the database table names and field names:

File name, database table name: UserAdmin, Menu, MenuSort, table_UserList, tb_UserList, tbUserList

Database Field Name: State UserName UserPassword AddDate 

SQL language coding standard: the best capitalized all keywords, such as: SELECT DELETE, UPDATE, INSERT, etc.

 


1: Hungarian notation
beginning with the letter abbreviation with variable types, and the rest in English or English abbreviation of variables, requiring word first letter capitalized.
eg: iMyName represent variable of type int

2: (small hump) camel nomenclature
first word of the first letter lowercase, followed by other word capitalized.
eg: myName

3: Pascal nomenclature (large hump)
of each word of the first letter capitalized.
eg: MyName

 

Named verb

A good general function name can be directly informed of the name of the function to realize what kind of function. First of all, if you can not give this function
a suitable name for the code that you will understand the functions to be achieved is not in place, or that your understanding of the demand is still not
sufficient. Secondly, if your name does not accurately reflect the function function function, then you may smell a "taste bad code" (reference
test "reconstruction"), may mean that the function is too large, need to refine the coupling more small, function more independently several functions.
Function name is generally recommended uniform use of the verb or verb + form noun: init (), getName ()
relates to the function recommended Boolean logic employed is, has, contains instead of the beginning of the verb: isObject (), hasClass (),
containsElements ()
Some common verbs, and can draw reference:
isObject (), hasClass ()
gET get / set settings, add increase / remove delete
create creation / destory remove start start / stop stop
open open / close close, read read / write write
load load / save save, create create / destroy destroyed
end begin start / end, backup backup / restore restore
import import / export export, split split / merge merge
inject inject / extract extracts, attach attach / detach from
bind binding / separate separation, view view / browse browse
edit edit / modify modify, select select / mark marked
copy copy / paste paste, undo undo / redo redo
insert insert / delete remove, add adding / append add
clean clean up / clear Clear, index index / sort sort
find find / search search, increase increase / decrease decrease
play play / pause pause, launch start / run run
compile compile / execute execution, debug debug / trace tracking
observe observe / listen listen, build build / publish release
input input / output outputs, encode encode / decode decoding
encrypt encrypt / decrypt decrypt, compress compress / decompress decompression
pack pack / unpack unpacking, parse parse / emit generating
connect connect / disconnect disconnect, send send / receive receiving
download download / upload upload, refresh refresh / synchronize synchronization
update update / revert recovery, lock to lock / unlock unlock
check out check out / check in check in, submit submit / commit delivery
push push / pull pull, expand expand / collapse folded
end begin start / end, start start / finish to complete
enter enter / exit to exit, abort give up / quit leaving
obsolete scrap / depreciate waste, collect collect / aggregate gather

HTML nomenclatures Name Reference:

(A) naming convention:
Head: header    
content: content / container   
Tail: footer   
Navigation: nav   
sidebar: sidebar   
column: column   
page peripheral control the overall layout width: wrapper    
around in: left right center   
Login Article: loginbar      
logo: logo       
advertisement: banner        
page body: main         
hot: hot         
news: news      
Downloads: download        
sub navigation: subnav       
menu: menu          
submenu: submenu        
search: search        
Links: friendlink        
footer: footer      
copyright: copyright         
scroll: scroll        
content: content         
tabs: tab        
article list: list         
message: msg      
tips: tips         
Section title: title          
added: joinus          
Guide: guild           
service: service          
registration: regsiter          
status: status        
vote: vote     
Partner: partner   

 

(B) Note the wording:

/ * Footer * /
content area
/ * End Footer * /

(C) id name:

(1) page structure
of the container: container
header: header
content: content / container
main page: main
footer: footer
Navigation: nav
sidebar: sidebar
columns: column
page peripheral control the overall layout width: wrapper
around the: left right center

(2) Navigation

Navigation: nav
main navigation: mainbav
sub-navigation: subnav
top navigation: topnav
side navigation: sidebar
left navigation: leftsidebar
right navigation: rightsidebar
menu: menu
submenu: submenu
title: title
Abstract: summary

(3) Function

Logo: logo
advertising: banner
login: login
login item: loginbar
registration: regsiter
search: search
function areas: shop
Title: title
added: joinus
status: status
Button: btn
Scroll: scroll
tabs: tab
article list: list
message: msg
current: current
tips: tips
icon: icon
Notes: note
Guide: guild
service: service
hot: hot
news: news
Downloads: download
vote: vote
partner: partner
Links: link
copyright: copyright

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/creekxu/p/11805268.html