Programmers Hub
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

Comments