In large organizations, is necessary. It allows different teams to work on different parts of the codebase without needing to know how the other parts work internally, as long as they know how to interact with them.
Each team is free to work on their parts of the code in any way they want, as long as all teams agree on how the external should look.
In some languages, this can be enforced at a language level, by marking properties as private or public. A private property is only accessible from within the script it is defined in, while a public property can be accessed from other scripts. Some languages also have protected properties, which are only accessible from subclasses.
In GDScript, there's no private or public keyword. Instead, GDScript uses a convention to mark properties as private or public. A property is considered private if its name starts with an underscore (_). This is called pseudo-private. It's a convention, not a language feature, so it's up to the programmer to respect it.
Become an Indie Gamedev with GDQuest!in GDSchool
Don't stop here. Step-by-step tutorials are fun but they only take you so far.
Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.