Key Takeaway:
The key is using AI tools as assistants rather than replacements for understanding,
with careful review of all generated code.
Yes, AI tools can definitely be used to refactor existing code, and this is actually one of their stronger
applications. Here's how:
When using AI for refactoring, it works best when you:
AI refactoring works best as a collaborative process where you guide the changes and validate
results rather than blindly accepting suggestions.
Yes, AI tools can be very effective at writing unit tests, and this is becoming one of their most popular
use cases. Here's what you should know:
AI is particularly useful for:
Key Takeaway:
The key is treating AI as a starting point that accelerates test writing, but not as a replacement
for thoughtful test design and quality review.
Yes, AI tools can be used to scan code for security vulnerabilities, and they're becoming
increasingly effective at this task. However, they should be used as part of a comprehensive
security strategy rather than as the sole security measure.
Key Takeaway:
AI tools are valuable for identifying security vulnerabilities in code and can
significantly improve your security posture when used properly. However, they
should be part of a comprehensive security strategy that includes multiple testing
approaches, human expertise, secure development practices, and continuous monitoring.
Always validate AI findings and never rely on automated tools alone for critical
security decisions.
Yes, AI is excellent at generating code documentation and this is one of its most practical
and time-saving applications. AI can create various types of documentation quickly and consistently.
Key Takeaway:
AI excels at generating initial documentation drafts and maintaining consistency,
but human review is essential to add context, verify accuracy, and ensure documentation
truly serves its intended audience.
Rust has well-defined naming conventions that are enforced by the compiler and linting tools.
Following these conventions is considered idiomatic Rust and helps maintain consistency across
the ecosystem.
| Item | Convention | Example |
|---|---|---|
| Files | snake_case | my_module.rs, user_service.rs |
| Modules | snake_case | mod user_authentication; |
| Types (structs, enums, traits) | UpperCamelCase (PascalCase) | MyStruct, HttpRequest |
| Functions | snake_case | calculate_total(), get_user() |
| Variables | snake_case | user_name, total_count |
| Constants | SCREAMING_SNAKE_CASE | MAX_SIZE, DEFAULT_TIMEOUT |
| Static variables | SCREAMING_SNAKE_CASE | GLOBAL_CONFIG |
| Type parameters | UpperCamelCase (concise) | T, E, K, V |
| Lifetimes | lowercase, short | 'a, 'b, 'static |
| Macros | snake_case! | println!, vec! |
snake_case for file namesmain.rs or lib.rsUpperCamelCase (also called PascalCase)HttpRequest not HTTPRequestsnake_casename() not get_name()set_name()is_empty(), has_value()snake_case_unused_ for intentionally ignored valuesSCREAMING_SNAKE_CASEUpperCamelCase, typically single lettersT for type, E for error, K for key, V for valueItem, Error'a, 'b, 'c for simple cases'src, 'dst'static is a special reserved lifetimesnake_case followed by exclamation mark! distinguishes macros from functionssnake_case for crate names in Cargo.tomlmy-crate becomes my_crateUpperCamelCase like typesSCREAMING_SNAKE_CASEsnake_casenew()non_snake_case, non_camel_case_types, etc.#[allow(non_snake_case)] to suppress warnings when necessary (rarely needed)clippy provide additional linting for naming conventions
Note:
Following these conventions is strongly recommended as they are deeply ingrained in the
Rust ecosystem. The compiler and tooling actively encourage these patterns, making it easier
to write idiomatic, maintainable Rust code.
Unlike Rust, C++ does not have a single, universally enforced naming convention. Different organizations
and style guides use different conventions. However, there are common patterns and several widely-adopted
style guides that provide consistency within projects.
C++ naming conventions vary significantly across different codebases and organizations. The most
important thing is to be consistent within your project and follow your team's
chosen style guide. Below are the most common conventions.
| Item | Common Conventions | Examples |
|---|---|---|
| Files | snake_case or PascalCase | my_class.cpp, MyClass.cppmy_class.h, MyClass.h |
| Header Files | .h, .hpp, .hxx | myclass.h, myclass.hpp |
| Classes/Structs | PascalCase or snake_case | MyClass, HttpRequestmy_class, http_request |
| Functions/Methods | camelCase, PascalCase, or snake_case | calculateTotal(), CalculateTotal()calculate_total() |
| Variables (local) | snake_case or camelCase | user_count, userCount |
| Member Variables | Various (see details below) | m_data, data_, _data, mData |
| Constants | SCREAMING_SNAKE_CASE or kPascalCase | MAX_SIZE, kMaxSize |
| Macros | SCREAMING_SNAKE_CASE | MY_MACRO, DEBUG_MODE |
| Namespaces | snake_case or lowercase | my_namespace, myproject |
| Template Parameters | PascalCase or single letter | T, ValueType, Iterator |
| Enums | PascalCase (type) + PascalCase or SCREAMING (values) | enum Color { Red, Green }enum Color { RED, GREEN } |
.h, .hpp, or .hxx extensions.cpp, .cc, or .cxx extensionsMyClass.h and MyClass.cppmy_class.hPascalCase (UpperCamelCase)snake_case (less common outside STL)PascalCase - CalculateTotal()snake_case - calculate_total()PascalCase - CalculateTotal()calculateTotal()name() not getName() (STL style)is_valid(), has_data()snake_case or camelCaseg_: g_app_stateMultiple conventions exist - choose one and be consistent:
m_ prefix: m_data, m_countdata_, count__data, _count (avoid - reserved in some contexts)mData, mCountdata, countconst variables: Often kPascalCase or SCREAMING_SNAKE_CASEconstexpr variables: Same as constPascalCase or SCREAMING_SNAKE_CASESCREAMING_SNAKE_CASEsnake_case or all lowercaseT, U, VPascalCase for complex cases: ValueType, AllocatorT for type, N for size, Pred for predicatePascalCasePascalCase or SCREAMING_SNAKE_CASEenum class (C++11+) recommended over plain enumPascalCase - MyFunction()snake_case - my_variablePascalCase - MyClasskPascalCase - kMaxValuemember_camelCase - myFunction()PascalCase - MyVariablePascalCase - MyClassPascalCase - MemberVarsnake_casesnake_case - std::vectorsnake_case - push_back()__ anywhere (reserved for compiler)_MyVar (reserved)_global (reserved)enum class over plain enumconstexpr instead of macros when possibleinline variables (C++17) for constants in headers
Bottom Line:
Unlike Rust, C++ has no enforced standard. The most important thing is to choose a style guide
(Google, LLVM, your own) and apply it consistently across your codebase. Use automated tools
to help enforce your chosen conventions.
C# has well-established naming conventions defined by Microsoft in the official .NET design guidelines.
These conventions are widely adopted across the C# ecosystem and are considered best practices for
writing clean, maintainable code.
| Item | Convention | Example |
|---|---|---|
| Files | PascalCase (match type name) | MyClass.cs, UserService.cs |
| Namespaces | PascalCase | MyCompany.MyProduct.MyFeature |
| Classes | PascalCase | CustomerAccount, HttpClient |
| Interfaces | PascalCase with I prefix | IDisposable, IEnumerable |
| Methods | PascalCase | GetUser(), CalculateTotal() |
| Properties | PascalCase | FirstName, IsActive |
| Events | PascalCase | ButtonClicked, DataReceived |
| Fields (public/protected) | PascalCase | MaxValue, DefaultTimeout |
| Fields (private) | camelCase or _camelCase | userName, _userName |
| Constants | PascalCase | MaxConnections, Pi |
| Parameters | camelCase | userId, firstName |
| Local Variables | camelCase | userCount, totalPrice |
| Enums | PascalCase (type and values) | Color.Red, Status.Active |
| Type Parameters | PascalCase with T prefix | T, TKey, TValue |
| Async Methods | PascalCase with Async suffix | GetUserAsync(), SaveDataAsync() |
PascalCase for file names.cs extension for all C# source filesPascalCasePascalCase for all namespace componentsCompanyName.ProductName.Feature.SubFeaturePascalCasePascalCase with I prefixIDisposable, IComparablePascalCaseAsync suffixPascalCasePascalCase (rare - prefer properties)camelCase or _camelCase (underscore prefix)PascalCase (not SCREAMING_SNAKE_CASE like in C/C++)const and static readonlycamelCase_PascalCasePascalCasePascalCaseOpening/OpenedOnEventNamePascalCase with T prefixTTKey, TValue, TResultPascalCaseEventHandlerCallback or Func suffixPascalCaseAttribute suffixIO, UIHtml, Xml, JsonhtmlDocumentIsValid not IsNotValidIs, Has, Can, Should, SupportsIsEnabled is clearer than EnabledAsync suffixTask or Task<T>async void except for event handlersUsers, Orders, ItemsUserList, OrderCollectionPascalCase like regular methods
Key Takeaway:
C# has very well-defined and widely-adopted naming conventions. Following Microsoft's official guidelines
ensures your code is readable and maintainable, and integrates well with the broader .NET ecosystem.
Use automated tools to enforce these conventions consistently.
Python naming conventions are defined in PEP 8 (Python Enhancement Proposal 8), the official style guide
for Python code. These conventions are widely adopted across the Python community and are considered
the standard for writing Pythonic code.
| Item | Convention | Example |
|---|---|---|
| Files/Modules | snake_case, short, lowercase | my_module.py, user_service.py |
| Packages | snake_case or lowercase, short | mypackage, my_package |
| Classes | PascalCase (CapWords) | MyClass, UserAccount |
| Exceptions | PascalCase, end with "Error" | ValueError, ConnectionError |
| Functions | snake_case | calculate_total(), get_user() |
| Methods | snake_case | process_data(), is_valid() |
| Variables | snake_case | user_count, total_price |
| Constants | SCREAMING_SNAKE_CASE | MAX_SIZE, DEFAULT_TIMEOUT |
| Private attributes | _leading_underscore | _internal_value, _helper() |
| Name mangling | __double_leading_underscore | __private_var |
| Magic methods | __double_underscores__ | __init__, __str__ |
| Type variables | PascalCase, short | T, KT, VT |
snake_case or all lowercasePascalCase (also called CapWords)_InternalClassPascalCase like classessnake_case_private_method()snake_casei, j, kSCREAMING_SNAKE_CASE_protected - Weak "internal use" indicator__private - Triggers name mangling__double_underscores__ on both sides__init__, __str__, __repr__PascalCaseT, U, VKT (key type), VT (value type)snake_case for parameter namesself for first argument of instance methodscls for first argument of class methodsi, j, k for loop counterse for exceptions in except clausesf for file handles_ for unused variables or "don't care" valuesis_, has_, can_is_valid not is_not_validusers, items, valuesuser_by_id, config_optionssnake_case: treat acronyms as words: html_parser, json_dataPascalCase: capitalize first letter only: HtmlParser, JsonDataHTTPServersnake_case conventionsnake_case file namesimport numpy as npfrom module import *https://www.python.org/dev/peps/pep-0008/# noqa comment to suppress specific warnings
Key Takeaway:
Python has very clear naming conventions defined in PEP 8. Following these conventions makes your code
more readable and maintainable, and helps it integrate seamlessly with the broader Python ecosystem.
Use automated tools like black, flake8, and isort to enforce consistency effortlessly.