An ACTION is an architectural element for Frontend applications. Not to be confused with elements of Backend applications such as handlers, controllers, routers or services
Definition:
An action is a function that modifies the state of an application. An action can be seen as the abstraction of CRUD operations on a Front end Application.
Actions should always communicate errors using Exceptions.
Actions should always have Business Objects as return types: Customers, List of Invoices, etc
Elements of an Action:
Validations: Data integrity and schema validation.
Normalization: data transformation between domains: Multiple objects to Domain Objects
Query or Mutations: normally with external services
Events propagation: dispatches, event bus, etc
Exceptions: For validation, services communication, success, server errors, etc
Logging
Naming
Actions should de named using CRUD verbs and Business Object Namesm, Examples:
An ACTION is an architectural element for Frontend applications. Not to be confused with elements of Backend applications such as
handlers
,controllers
,routers
orservices
Definition:
An action is a function that modifies the state of an application. An action can be seen as the abstraction of CRUD operations on a Front end Application.
Actions should always communicate errors using Exceptions. Actions should always have Business Objects as return types: Customers, List of Invoices, etc
Elements of an Action:
Naming
Actions should de named using CRUD verbs and Business Object Namesm, Examples:
createCustomer
,createInvoice
,createUser
,createSession
fetchCustomer
,fetchInvoice
,fetchUser
,fetchSession
updateCustomer
,updateInvoice
,updateUser
,updateSession
deleteCustomer
,deleteInvoice
,deleteUser
,deleteSession
Other operations should follow the same convention for naming, for example: ARCHIVE, DESTROY, UP SERT, etc
Example 1: Basic Action
Example 1:
createAction
shortcut