Organize into Parallel Projects Based on Separation of Concerns

A key principle of software engineering is to architect a system into subprojects that can proceed independently. This article describes how your team can organize into parallel projects, that are based on separation of concerns (SoC), using
Layer7 Live API Creator
.
SoC provides important parallelization of development activities:
  • Proper client/server partitioning:
    Layer7 Live API Creator
    properly partitions your business logic to the server, where you can share it and can develop it in parallel with client application development.
  • Interface logic is independent of business logic: You can define resources in parallel with logic development.
In this article:
Clients
It is common for services–such as pagination, optimistic locking, or generated key handling–to burden client applications.
Layer7 Live API Creator
properly partitions these services to API Server. Clients interact with service endpoints, which provide the following services:
  • Connectivity.
    Virtually all languages facilitate HTTP/RESTful APIs.
  • Resources that you define explicitly in API Creator (the database abstraction layer).
    Layer7 Live API Creator
    facilitates client development through resources that you explicitly define. These resources select the correct columns, alias them, and join multiple objects together. The client can retrieve them simply, in one trip.
    Layer7 Live API Creator
    automatically reuses the underlying logic, even when you have defined multiple client-specific resources.
    For more information about resources that you define explicitly using API Creator, see Customize your API.
  • Object model.
    Some languages are built around objects. For example, Java Plain Old Java Objects (POJOs) and .NET Plain Old CLR Objects (POCOs). You can create these objects using Swagger SDKs.
    For more information of the JavaScript object model and logic re-use, see Row Objects.
  • Application partitioning (no "fat client").
    Effective applications depend on proper partitioning of logic between the client and server. This is often a source of architectural error, resulting in duplicated/inconsistent logic, poor performance, and unavailability of logic for non-interactive applications. The following
    Layer7 Live API Creator
    services provide meaningfully improved re-use and reduced development time.
  • Pagination.
    Pagination breaks large result sets into page-size chunks, to ensure good performance. This is often part of client database-handling code. API Server provides pagination.
    For more information about pagination, see Live API Creator Architecture.
  • Optimistic locking.
    Optimistic Locking is a commonly accepted approach for increasing concurrency by enabling updates to unlocked data. This requires various mechanisms, such as timestamps and checksums, that often require client code. API Server automates optimistic locking.
    For more information about optimistic locking, see Performance.
  • Logic.
    While it is an anti-pattern, business logic for database integrity is often placed in client applications. This leads to poor performance (multiple trips), redundant inconsistent code (due to replication), and inability to access logic (for example, for Web Services). API Server provides reactive logic, so that such logic is factored out of client, and significantly more concise.
    For more information about reactive logic, see Declare your Logic.
  • Security.
    Typical applications include substantial logic on the controller buttons to inject security filters into queries, for example, to ensure a sales rep sees only their own orders. Such logic is tedious and difficult to ensure compliance. API Server enforces role-based row/column-level access.
    For more information about security, see Securing APIs.
  • Primary key generation.
    Consider creating an order, with a set of line items. If the order has an automatically-generated key, the client could be forced into the following server interactions:
    • Insert the order and obtain the generated key.
    • Insert the items, having placed the OrderID into each item.
    This is a lot to code, and performs poorly due to multiple server trips. API Server automatically generates primary keys. You define a resource that includes the related data explicitly using API Creator, submit it, and then the resource partitions the logic to the server.
    For more information about how API Server automatically generates primary keys, see Automatic Key Generation.
Service Endpoints
A non-trivial architectural challenge is where to place business logic. Is business logic placed in each service? Is it placed in underlying domain objects?
Layer7 Live API Creator
factors this logic out of the services. Requests automatically enforce your logic and security.
Reactive Logic
A typical first step for implementing business logic is to create an object model.
Layer7 Live API Creator
creates that automatically.
For more information about the JavaScript object model, see Row Objects.
Database
You can iterate your database with minimal effect on clients, since services hide the underlying data model. When the data model changes, you can verify your API.
Layer7 Live API Creator
rebuilds the object model and determines which services/logic require re-targeting.
For more information about how to verify APIs, see Database Connectivity.