
Programmers Hub
June 6, 2025 at 02:04 PM
๐ก๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ด ๐ง๐ถ๐ฝ - ๐ฆ๐ป๐ฎ๐ธ๐ฒ ๐๐ฎ๐๐ฒ vs ๐๐ฒ๐ฏ๐ฎ๐ฏ ๐๐ฎ๐๐ฒ vs ๐๐ฎ๐บ๐ฒ๐น ๐๐ฎ๐๐ฒ vs ๐ฃ๐ฎ๐๐ฐ๐ฎ๐น ๐๐ฎ๐๐ฒ
๐ฅIn the programming world, consistent and clear code is essential. This extends beyond code structure to how you name elements like variables, methods, functions, classes and files. Naming conventions provide rules or guidelines developers follow to ensure code consistency and clarity.
Let's explore four common naming conventions:
โ
๐ฆ๐ป๐ฎ๐ธ๐ฒ ๐๐ฎ๐๐ฒ: Words are separated by underscores (_), each in lowercase. It's commonly used in languages like Python for variable and function names.
Ex: ๐๐ช๐จ๐ฉ๐ค๐ข๐๐ง_๐ฃ๐๐ข๐, ๐ช๐จ๐๐ง_๐ฃ๐๐ข๐
โ
๐๐ฒ๐ฏ๐ฎ๐ฏ ๐๐ฎ๐๐ฒ: Words are separated by hyphens (-) and each word is in lowercase. It's often used in URLs and CSS selectors.
Ex: ๐ฉ๐ค-๐๐ค-๐ก๐๐จ๐ฉ
โ
๐๐ฎ๐บ๐ฒ๐น ๐๐ฎ๐๐ฒ: Words are concatenated without spaces, and each word after the first starts with a capital letter. It's prevalent in languages like JavaScript and Java for variable and function names.
Ex: ๐๐ช๐จ๐ฉ๐ค๐ข๐๐ง๐๐๐ข๐, ๐๐ข๐๐๐ก๐ผ๐๐๐ง๐๐จ๐จ
โ
๐ฃ๐ฎ๐๐ฐ๐ฎ๐น ๐๐ฎ๐๐ฒ: Similar to Camel Case, but the first word also starts with a capital letter. It's commonly used for class and method names in languages like C# and Ruby.
Ex: ๐พ๐ช๐จ๐ฉ๐ค๐ข๐๐ง, ๐๐๐ฉ๐ฝ๐ฎ๐๐()
โค๏ธ
2