What is dot.case?
dot.case is a naming convention where words are separated by periods (dots) and all letters are lowercase. It's commonly used for object property access, namespaces, and configuration keys.
Examples:
user.profile.name
app.config.database
system.settings.theme
api.response.dataWhen to Use dot.case
- Object properties: Accessing nested properties (user.email, config.api.key)
- Configuration keys: Settings and configuration files
- Namespaces: Organizing code in hierarchical structures
- Environment variables: Some systems use dot notation
- Package names: In some ecosystems (Java, Android)
- Translation keys: i18n and localization systems
Examples in Code
JavaScript Object Access:
const user = {
profile: {
name: "John",
email: "john@example.com"
}
};
// Access: user.profile.nameConfiguration Files:
{
"app.name": "MyApp",
"app.version": "1.0.0",
"database.host": "localhost",
"database.port": 5432
}Java Package Names:
package com.example.myapp;
import java.util.ArrayList;
import android.app.Activity;Common Use Cases
Translation Keys
i18n libraries often use dot notation for organizing translations: common.buttons.save, errors.validation.required
Nested Properties
Accessing deeply nested object properties in a hierarchical manner.
Namespacing
Organizing code modules and preventing naming conflicts in large codebases.
Best Practices
- ✓ Use for hierarchical structures
- ✓ Keep hierarchy levels reasonable (2-4 levels)
- ✓ Use descriptive names at each level
- ✓ Consistent with object property access
- ✗ Avoid overly deep nesting
- ✗ Don't mix with other separators inconsistently