Programming advanced techniques: naming convention and camelCase
Last updated on:2 years ago
There are four main types of coding customs to name something in your programs: Hungarian notation, camel case, Pascal case and underscore case. I would like to use the camel case to write my code.
What is the camel case?
Camel case (sometimes stylized as camelCase or CamelCase, also known as camel caps or more formally as medial capitals) is the practice of writing phrases without spaces or punctuation, indicating the separation of words with a single capitalized letter, and the first word starting with either case. Common examples include “iPhone” and “eBay”.
My rules
Constant: CAMELCASE
Variable :CamelCase
Class: CamelCaselastcase
Function: camelCase
Function file: camelCase
Data file: camel_case (.xlsx, .jpg)
Folder: camelcase
Logical connective
Add space before and after logical connective when do logical operation. If just use for recall function, I won’t add theses spaces.
a + b = 1
d = func(index=1, k=2)
Reference
[1] Camel case
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!