bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Competing naming conventions for types

Open benfrankel opened this issue 1 year ago • 11 comments

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, probably Set
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:

  • Observable events
  • Marker components

benfrankel avatar Jul 11 '24 00:07 benfrankel

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.

benfrankel avatar Jul 11 '24 00:07 benfrankel

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

alice-i-cecile avatar Jul 11 '24 01:07 alice-i-cecile

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 avatar Jul 11 '24 01:07 benfrankel

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

benfrankel avatar Jul 11 '24 01:07 benfrankel

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.

janhohenheim avatar Jul 11 '24 05:07 janhohenheim

My preference is Set as well.

alice-i-cecile avatar Jul 11 '24 12:07 alice-i-cecile

There seems to be some sentiment on Discord in favor of Systems for system sets (from cart, Jondolf, and mweatherley: link). I'm personally still on the fence but I think avoiding the ambiguity of FooSet may be worth the extra length.

benfrankel avatar Nov 25 '24 22:11 benfrankel

Could make SystemSet short via SysSet since everyone knows Sys is abbreviation for system

Atlas16A avatar Nov 25 '24 22:11 Atlas16A

Abbreviations like that are slower to read and very confusing for beginners / non-native speakers.

alice-i-cecile avatar Nov 25 '24 22:11 alice-i-cecile

I agree. Abbreviations are generally detrimental, in my opinion. It's much easier to write code than to read it. Why make it harder to read?

BenjaminBrienen avatar Nov 25 '24 22:11 BenjaminBrienen

A Discord poll resulted in 26-1-27-3 votes for FooSystems vs FooSystem vs FooSet vs Foo.

benfrankel avatar Nov 26 '24 22:11 benfrankel