Choose names that clearly describe the purpose, behavior, or content of variables, methods, and classes. Avoid ambiguous or generic names that require additional context to understand.
Choose names that clearly describe the purpose, behavior, or content of variables, methods, and classes. Avoid ambiguous or generic names that require additional context to understand.
Key principles:
timeout_seconds
instead of timeout
)create_or_update
instead of create_alias
)_creator_user_id
instead of _created_by
)doc_ids
instead of doc_id
)preserve_flask_contexts
instead of flask_context_manager
)Examples of improvements:
# Before: Ambiguous naming
def create_alias(user, timeout):
doc_id = set()
# After: Descriptive naming
def create_or_update_alias(creator_user_id, timeout_seconds):
doc_ids = set()
This practice makes code self-documenting and reduces the cognitive load for developers reading and maintaining the codebase.
Enter the URL of a public GitHub repository