As with your Lua, remember that your XML is written once but read many times. Consider how to make it more readable and readily modifiable for the future. You may forget why you wrote it a certain way, or your project may gain a new team member who may not have as much context or understanding as you did when you first wrote it.
Naming Standards
XML Data Object Names: Meta/ChatFrame/MessageTextTemplate
- UpperCamelCase
- Forward-slash as if folder structures to indicate nested layouts:
- Try to name them to indicate what game system (meta, game, etc) and game mechanic (revive, watch ad) the UI frame is used for.
- If a frame is included in another frame, indicate that in the name path. E.g. in the base example, this “MessageTextTemplate” is used in the “ChatFrame” file, so it’s indicated in the path
Include names: include id="quest_page"
- snake_case
- This lends itself to reference ui layouts from the GMUI mod in a consistent case such as “local layout = ui.glue.quest_page”
Layout Frame Names: Frame id="BackgroundImage"
- UpperCamelCase
- This lends itself to reference ui layout frames from the GMUI mod, such as “DCEI.SetBackgroundImage(ui.glue.quest_page.BackgroundImage, some_image)”
- Frame names should include the name of the frame type (text, button, scroll, etc)
States: <State name="is_selected"/>
- snake_case
- Try to name for clarity when used grammatically in property binding
- e.g. “bind:active="state.is_legendary and not state.is_preview”
Local Constants: <Constant name="icon_texture" />