If you have ever stared at a codebase and wondered who named that variable my_var_but_like_weird, you are not alone. Naming is less glamorous than refactoring but more useful than a thousand bike sheds. This guide walks through the sane naming conventions for Java, Python, JavaScript, Rust and Mojo with real examples and small amounts of fruity sarcasm.
Consistency matters more than your clever acronyms. Consistent names make code readable, tooling predictable, and code reviews less like gladiator fights. Linters and formatters are your friends. Yes they will force you to rename your favorite variable. You survive.
Java culture likes camelCase and a clear distinction between values and types. Use camelCase for variables and methods, PascalCase for class and interface names, and UPPER_SNAKE for constants. Example names that will make your teammates nod:
myVariable
for a variablecalculateTotal
for a methodMyClass
for a classMAX_SIZE
for a constantPython leans into readability with snake_case for variables and functions. Classes use PascalCase and constants use UPPER_SNAKE. PEP 8 exists for a reason. Follow it unless you enjoy arguing in pull requests.
my_variable
for a variable or functionMyClass
for a classMAX_SIZE
for a constantJavaScript is pragmatic. Most code uses camelCase for variables and functions, PascalCase for constructor functions and types, and constants either UPPER_SNAKE or just const names in camelCase depending on team taste. Be consistent within the project so your public API does not look indecisive.
myVariable
for variablescreateElement
for functionsMyComponent
for a constructor or componentMAX_SIZE
or defaultTimeout
for constants depending on styleRust has strong opinions and they make sense. Use snake_case for variables and functions, CamelCase for types, and SHOUTY_SNAKE for constants. The compiler is strict and the community expects readable names.
my_variable
for a variabledo_work
for a functionMyType
for a struct or enumMAX_SIZE
for a constantMojo follows Python style in many places. Use snake_case for functions and variables, PascalCase for structs and types, and UPPER_SNAKE for constants. If you work with Python and Mojo side by side you get the blessed bonus of fewer naming fights.
my_variable
for variables and functionsMyStruct
for structs and typesMAX_SIZE
for constantsx
is OK in tiny loops, not in business logicWhen you bridge languages remember that naming expectations impact users. A JavaScript API exposed to Python users should consider snake_case wrappers or clear docs. Bindings and code generation often assume certain casing so pick names that survive translation.
Names are cheap and valuable. Be boringly consistent and mercilessly clear. Your future self and your team will thank you, and code reviews will spend less time arguing about capitalization and more time fixing real problems.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.