bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
34.89k stars 3.41k forks source link

Competing naming conventions for types #14274

Open benfrankel opened 1 month ago

benfrankel commented 1 month ago

Some traits have competing naming conventions for types within Bevy:

Trait Suffixes used Suggestion
SystemSet System, Set, Systems, no-suffix Not obvious which to choose
Primitive3d 3d, 3, 3A, no-suffix Probably fine as-is
Primitive2d 2d, 2, no-suffix Probably fine as-is
Event Event, no-suffix Probably fine as-is
ScheduleLabel Schedule, no-suffix Just rename ExtractSchedule
RenderLabel Label, no-suffix Just rename CameraDriverLabel
SystemParam Param, no-suffix Just rename UiLayoutSystemRemovedComponentParam
PluginGroup Plugins :white_check_mark: (not counting PluginGroupBuilder)
Plugin Plugin :white_check_mark:
Bundle Bundle :white_check_mark:
AppLabel App :white_check_mark:
System System :white_check_mark:
Material Material :white_check_mark:
Component no-suffix :white_check_mark:
Resource no-suffix :white_check_mark:
Command no-suffix :white_check_mark:
Asset no-suffix :white_check_mark:
States N/A :white_check_mark: (no types provided by Bevy)
EntityCommand N/A :white_check_mark: (no types provided by Bevy)

Hard to search for because no distinguishing trait:

benfrankel commented 1 month ago

Event, Primitive2d, and Primitive3d are probably "fake inconsistent" and fine to stay as they are. So this can be narrowed down to SystemSet and three odd-one-out type names.

alice-i-cecile commented 1 month ago

Can you explain more about what you think should be done in all of the inconsistent cases?

benfrankel commented 1 month ago

I've edited the original comment with more context.

Evaluating the options for SystemSet

FooSystems:

+ Parallels `Plugins` for `PluginGroup`
+ Unambiguous
- Longest option (besides `SystemSet` as a suffix...)
- Used by 2/20 bevy system set types: `SimulationLightSystems` and `VisibilitySystems`
- Rarely (never?) used by 3rd-party crates

FooSystem:

+ Used by 10/20 bevy system set types.
+ Used by 3rd-party crates sometimes
- Still long
- Ambiguous (is it a system or a system set?)

FooSet:

+ Very short
+ Commonly used by 3rd-party crates
- Used by 2/20 bevy system set types: `RenderSet` and `ExtractMeshesSet`
- Ambiguous (is it a `SystemSet` or a set of `Foo`?)

Foo:

+ Shortest possible
+ Used by 6/20 bevy system set types
- May conflict with names of related types
- Not obvious that it's a `SystemSet`
- Rarely used by 3rd-party crates
benfrankel commented 1 month ago

I'm leaning Set for system sets, but it's not an obvious decision.

janhohenheim commented 1 month ago

I fully agree with the suggestions presented here. They seem reasonable and applicable. Especially the SystemSet inconsistency is a potential documentation hazard since users might not know what to search for.

alice-i-cecile commented 1 month ago

My preference is Set as well.