Interface Logic Versus Business Logic

In developing services, it is common to distinguish interface logic from shared business logic:
lac32
In developing services, it is common to distinguish
interface logic
 from shared
business logic
:
  • Interface Logic
    Interface logic is logic that is specific to a service. When you require logic specific to a service, you can define resources explicitly in your API, and then extend them, for example, with request event handlers, request/response transformation, or metadata action tags.
    The Business to Business (B2B) sample includes many of the concepts that describe interface logic in the resources that you define explicitly in your API and practical samples.
    For more information about the B2B sample, see Business to Business Example.
  • Business Logic
    Business logic is logic that you define for entities (tables and views) as reactive logic. 
    CA Live API Creator
     shares this logic across all resources that you define explicitly in your API and associates it with the row objects. This automatic sharing is a consequence of the resource/row mapping that is described in logic execution.
    Business logic describes the business logic for your API, expressed by reactive logic such as: 
    • Validation rules
      : Expressions that are assigned to an entity that must be true for a transaction to commit (else the transaction is rolled back and a suitable message is returned to the client).
    • Derivation rules
      : Spreadsheet-like rules for table/column derivations. For example, formula rules, sum rules, and parent copies. The rules chain to address multi-table transactions.
    • Event rules
      : Server-side JavaScript-code business logic that you assign to entities (tables or views) and that  
      CA Live API Creator
       fires depending on the event rule type.
    Best Practice:
    Because business logic is the point of highest reuse, use it to the maximum practical extent. 
    For more information:
These concepts of interface logic and business logic exist in
CA Live API Creator
:
Logic
Defined On
Facilities
Typical Uses
Interface
Resources
Point-and-click resource creation (including joining data from multiple databases).
Extend with:
Provide APIs for API consumers with more interface logic to optimize output and reduce latency.
Match external API agreements, particularly in the request and response formatting, for both retrievals and updates.
Business
Entities (Tables and Views)
Spreadsheet-like validations and derivations (for example, formulas, sums, and counts).
Row permissions.
Extend with row event handlers.
Business logic and security, which API Creator automatically invokes and re-uses across resources.
Validations and row event handlers fire only on update operations.