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.
-
1:30:34
FreshandFit
3 hours agoHow To Stay Focused While Pursuing Women...The Good, The Bad, And The Ugly
12.7K19 -
1:47:05
Drew Hernandez
7 hours agoISRAEL PLANNING POSSIBLE DRAFT IN USA & TRUMP'S VIEW ON ETERNAL LIFE ANALYZED
9K5 -
29:55
Afshin Rattansi's Going Underground
3 days agoProf. Omer Bartov: The REAL REASON the US, UK, and EU Have Not Recognised Israel’s Genocide in Gaza
7.3K24 -
LIVE
SpartakusLIVE
5 hours agoWednesday WZ with the Challenge MASTER || Duos w/ GloryJean
354 watching -
2:36:12
Barry Cunningham
4 hours agoREACTING TO STEPHEN MILLER | KASH PATEL | TULSI GABBARD INTERVIEWS AND MORE NEWS!
50.1K43 -
LIVE
Alex Zedra
2 hours agoLIVE! Solo Scary Game night
263 watching -
58:01
MattMorseTV
4 hours ago $8.36 earned🔴The Dems. just lost 4.5 MILLION voters.🔴
51.8K46 -
1:04:10
BonginoReport
6 hours agoCornhusker Clink & A Sizzling Border Wall Deter Illegals - Nightly Scroll w/ Hayley Caronia (Ep.116)
116K70 -
ZWOGs
10 hours ago🔴LIVE IN 1440p! - SoT w/ Pudge & SBL, The Finals w/ The Brrrap Pack, Kingdome Come - Come Hang Out!
6.92K -
LIVE
VapinGamers
2 hours ago $0.49 earnedOff The Grid - Yes I Have a Problem but Winning Aint One! #1 Controller Scrub NA - !rumbot !music
75 watching