- Underscore: Suppose your variable name is excellent_programming_tricks. Now if you click anywhere on the variable the whole variable is selected not the word. That's why underscore is most preferable for variable naming.
- Dash: Suppose your variable name is excellent-programming-tricks. Now if you click any where on the variable the world would be selected instead of whole variable name. Dash is not support in PHP function name.
- Camel Case (medial capitals): Where first case should be lower case. New word letters should be capitalized. Ex.: excellentProgrammingTricks.
- Pascal Case: First word and remaining words must be capital. Ex. ExcellentProgrammingTricks. For class name we use for pascal case.
- Note: No Space or underscore is required for both case.
- Basically the data type strategy mainly depends on project types. Suppose your client/project leader specifies how you declare your data type style then it's a blessing for you. Otherwise you follow your own strategy. Whatever your strategy is, it must collision with other programmer.
- CSS
- Class name: Dash use or camel case.[ class="abc-xyz" or class="abcXyz"]
- ID: Pascal Case.
- Name: Lower letter with underscore.
- JavaScript/PHP/WordPress
- Constant: Upper case.
- Variable name: Lower case/camel case or the first letter is a small letter. [ var iName ="CEO Dipen"]
- Function/Property name: Lower case/Camel case starting with underscore. [_abcXyz()]
- Class name: Pascal case.
- Instance of a class name: Camel Case.
No comments:
Post a Comment