Premium Only Content
#46 Naming Convention in Java | Skyhighes | Lecture 46
Here's a summary of common naming conventions in Java:
Purpose of Naming Conventions:
Readability: Make code easier to understand and maintain by using consistent and meaningful names.
Organization: Improve code structure and navigation by using conventions that indicate the purpose and scope of different elements.
Collaboration: Facilitate teamwork by ensuring everyone follows the same naming rules.
General Guidelines:
CamelCase for class names: Start with a capital letter, and capitalize each subsequent word (e.g., CustomerAccount, EmployeeSalaryCalculator).
camelCase for method and variable names: Start with a lowercase letter, and capitalize each subsequent word (e.g., calculateTotalAmount, customerName).
PascalCase for constants: Use all uppercase letters, separate words with underscores (e.g., MAX_VALUE, PI).
snake_case for package names: Use lowercase letters and separate words with underscores (e.g., com.example.myapp).
Meaningful names: Choose names that clearly reflect the purpose or role of the element.
Avoid abbreviations: Use full words for clarity, except for common abbreviations (e.g., URL, ID).
Specific Conventions:
Interface names: Use PascalCase (e.g., List, Runnable).
Abstract class names: Often start with the prefix "Abstract" (e.g., AbstractList, AbstractButton).
Private variables and methods: Often start with an underscore (e.g., _age, _initialize()).
Static variables and methods: Often start with the prefix "s_" or "m_" (e.g., s_instanceCount, m_calculateArea()).
Best Practices:
Adhere to conventions consistently: This ensures code uniformity and easier understanding for everyone.
Use meaningful and descriptive names: This makes code self-documenting and reduces the need for explicit comments.
Avoid overly long or short names: Aim for a balance between brevity and clarity.
Consider using a code style checker: This can help enforce naming conventions automatically.
Remember: While conventions are not strictly enforced by the Java compiler, following them is crucial for writing clear, maintainable, and professional code.
-
LIVE
FreshandFit
5 hours agoJoe Budden Arrested For Being A Perv! Tesla Cybertruck Explosion
7,309 watching -
2:08:45
Kim Iversen
8 hours agoNew Year, New PSYOP?: The Fort Bragg Connection In The New Years Terror Attacks
61.9K109 -
1:41:18
Glenn Greenwald
8 hours agoTerror Attacks Exploited To Push Unrelated Narratives; Facing Imminent Firing Squad, Liz Cheney Awarded Presidential Medal | SYSTEM UPDATE #381
90.2K160 -
1:00:32
Man in America
10 hours ago🔴 LIVE: Terror Attacks or False Flags? IT DOESN'T ADD UP!!!
47.6K14 -
1:02:38
Donald Trump Jr.
11 hours agoNew Year’s Terror, Latest Breaking News with Sebastian Gorka | TRIGGERED Ep.204
186K338 -
59:59
The StoneZONE with Roger Stone
7 hours agoAfter Years of Targeting Trump, FBI and DOJ are Unprepared to Stop Terror Attacks | The StoneZONE
55.2K14 -
1:26:42
Leonardaisfunny
5 hours ago $3.85 earnedH-1b Visas: Infinity Indians
35.1K18 -
1:08:33
Josh Pate's College Football Show
10 hours ago $2.41 earnedPlayoff Reaction Special: Ohio State Owns Oregon | Texas Survives | UGA vs Notre Dame Takeaways
33.9K6 -
58:04
Kimberly Guilfoyle
9 hours agoFBI's Terror Response Failures, Live with Steve Friend & Kyle Seraphin | Ep. 185
107K43 -
2:15:01
WeAreChange
10 hours agoMassive Developments In Vegas Investigation! UNREAL DETONATION, Shocking Details Emerge!
113K45