What conventions do most Mach II developers use for naming event handlers? - Mach-II/Mach-II-Framework GitHub Wiki
Mach-II allows for great flexibility in naming event handlers. There are few limits on how you can name events other than using alphanumeric characters for event names. However, a common convention has emerged which encourages grouping event-handlers within functional categories.
This convention organizes event-handler names by functional category and separates the functional category and the actual action (or function) being called by a period (.) character. Event-handlers created using this convention would look like this:
security.login
client.edit
reports.displaySales
The higher level functional category (i.e. "security", "user", or "reports") comes first, followed by a period character separator, followed by the actual function or business workflow that needs to be run. This convention can be extended further if the functional area (i.e. "user") is fairly complex and has logical sub-categories in to which functions can be grouped. In this case, event-handlers created using this convention would look like this:
admin.users.create
news.articles.postComment
Additional modifiers can be added to the end of an event-handler name to
indicate that the event is doing something out of the ordinary, or
special. For example, if an event-handler's purpose is to redirect the
user to another event after processing a form submission, you can add a
_redirect
flag to the end of the event name to make it clear the
special intent of that event handler. For example:
admin.company.create_redirect
On a side note, for special events such as the redirect event example
above it is best to set the access
modifier on the event-handler to
private
so only event announcements that are programmatically called
from within Mach-II can announce that event-handler.