Style Guide & Best Practices
To keep Aegis code clean and readable, we recommend following these conventions.
Naming Conventions
-
Variables & Functions: Use
snake_case.var my_variable = 10 func calculate_total() { ... } -
Classes: Use
PascalCase.class GameManager { ... } -
Constants: Use
UPPER_SNAKE_CASEinside Namespaces.namespace Config { var MAX_RETRIES = 5 }
File Structure
- Use
.aegextension for all scripts. - Place reusable code in a
lib/ormodules/folder. - Wrap library code in a
namespaceto avoid polluting the global scope.
Error Handling
Prefer try/catch over checking for null when performing I/O operations (File, Network).
// ✅ Good
try {
var data = File.read("config.json")
} catch (e) {
print "Config not found, using defaults."
}
// ❌ Avoid
var data = File.read("config.json") // If fails, script crashes!