-
Notifications
You must be signed in to change notification settings - Fork 8
Code Style Document
Valk edited this page Oct 28, 2024
·
33 revisions
If the following looks overwhelming to you, you can ignore it, I will try my best to refactor your PRs to conform to these standards.
Please familiarize yourself with these principles.
- Single Responsibility Principle (SRP)
- Don't Repeat Yourself (DRY)
- You Aren't Gonna Need It (YAGNI)
- Separation of Concerns (SoC)
- Create Context classes for methods with more than 2 parameters
- Favor Composition over Inheritance
- Hide what others should not see with Encapsulation
- Indentation: 4 spaces.
- Curly Braces: Always expand.
- Using Directives: Above namespace.
- PascalCase: Types, methods, properties, constants, events.
- camelCase: Private fields, local variables, method args.
-
Prefixes:
On
for events,Set
for set methods,Get
for get methods
- Static Functions: Use when possible.
- CallDeferred(): Avoid if alternatives exist.
- var Keyword: Never use.
- C# Delegate Events: Always use over Godot signals.
-
Explicit Private Modifiers: Always specify
private
.