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

[2] How to Write Beautiful Python Code With PEP 8