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
KingB33Gaming
37 minutes agoVengeance | Yakuza 0 Director's Cut (Chap 15)
72 watching -
12:14
Nikko Ortiz
1 day agoMilitary Fails Of The Week
10K11 -
1:16:31
Omar Elattar
9 months agoThe Untold Story: How Vans Became a $3 Billion Dollar Shoe Empire In 75 mins
15.2K8 -
LIVE
LethalPnda
2 hours agoLocked & Loaded! 🔥 Fate Trigger Beta #RazerCreator #SpacePanda @Mystivis
53 watching -
LIVE
BigDaddySlick78's Live Gaming Channel
2 hours ago💰I Pay You To Play Call of Duty Warzone Rebirth Island LIVE #callofduty #warzone #cod #gaming
35 watching -
1:59:43
Side Scrollers Podcast
2 days agoRIP Hulk Hogan + Payment Processor CENSORSHIP Has Officially Begun + More | Side Scrollers
142K13 -
LIVE
Lofi Girl
2 years agoSynthwave Radio 🌌 - beats to chill/game to
331 watching -
1:56:31
The Pascal Show
18 hours ago $4.10 earnedGHISLAINE FLIPS?! DOJ Receives SECRET LIST of 100 Epstein Associates!”
13.2K7 -
10:17
Dr Disrespect
11 days agoIt's Time To Get Serious
183K31 -
2:15:09
Badlands Media
1 day agoDevolution Power Hour Ep. 375: Obama’s Orders, Ukraine’s Collapse & the Inversion of Justice
303K120