Skip to content

RFC: AzLmbr Bus Event libraries for Python #57

@FuzzyCarter

Description

@FuzzyCarter

Summary:

An extensive library of Enums for the AzLmbr Bus Events to be used in python.

This would be a library of a raw bus event call that will pass the string for that event along instead of using string literals.

EG:

azlmbr.editor.EditorComponentAPIBus(bus.Broadcast, bus.EditorComponenetBus.AddComponentOfType, object)

vs

azlmbr.editor.EditorComponentAPIBus(bus.Broadcast, "AddComponentOfType", object)

What is the motivation for this suggestion?

Why is this important?

  • Prevents the use of using string literals that are prone to syntax errors.
  • Helps enforce SOLID and DRY software development by giving a single place for these libraries to live and usage of encapsulated data.
  • Makes updating a bus event structure easier by only having to change the value of the Enum vs finding each usage of the string in a bus event call.

What are the use cases for this suggestion?

  • Every azlmbr bus event call in the Python Automation scripts.

What should the outcome be if this suggestion is implemented?

  • An extensive library of enums to be used for calling bus events.

Suggestion design description:

  • AutoGen: Leverage the autogen to create the mappings for bus events automatically on every build
    • Advantages:
      • Mappings are updated every build allowing for up-to-date bus event mappings whenever the bus events are exposed/added/updated.
      • Eliminates automation maintenance for bus event updates due to the bus event mappings being automatically updated and remain, allowing the automation to remain stable.
      • Disadvantages:
        • Development time to plan and implement the basic autogen system for generating these.
        • This solution will require creating a pattern for changes in bus event names that will remap/point to the new event name.

Are there any alternatives to this suggestion?

  • Manual Generation: A small group of people dive into all the existing bus events and manually create an enum library of all exposed bus events.
    • Advantages:
      • Software design for this solution is minimal.
      • Updating bus events that had their name changed is easy and doesn't require a development pattern.
    • Disadvantages:
      • This will require manual maintenance when new busses are exposed, new bus events are created, or bus events change names/patterns.
      • Manual creation of enums could result in syntax errors (but are easy to fix once discovered)

What is the strategy for adoption?

  • Add the usage of libraries to the Automation Best Practices doc.
  • Add docs about the libraries.
  • Give a discord talk about the libraries.
  • Use PRs to help enforce the usage and spread of the knowledge of the libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions