Skip to main content

Distributed Delivery Mode

Overview

Distributed Delivery Mode is designed for teams that split product ownership, architecture, infrastructure decisions, and large-scale business implementation across locations.

In this mode:

  • Model owners own the domain model.
  • Central or delivery-side technical developers customize UserContext and define technical infrastructure.
  • A larger group of delivery developers use generated Q and E APIs to implement business services and controllers.

TeaQL helps this model because the generated Java API becomes a shared contract between model owners, technical leads, and delivery teams.


RoleTeam PositionMain ResponsibilityTeaQL Focus
Product ManagerModel ownerBusiness requirements, workflows, vocabularyDomain model
ArchitectModel owner / technical leadModel boundaries, integration boundaries, technical directionDomain model and architecture
Technical DeveloperPlatform or delivery teamRuntime customization and infrastructure policyCustomUserContext
Business DeveloperDelivery teamBusiness services, controllers, API implementationQ, E, service, controller
Tech LeadPlatform or delivery teamReview consistency and enforce patternsQuery utilities and service conventions

Role 1: Product Manager or Architect Owns Modeling

The model owner should own the model because they are closest to business intent and stakeholder communication.

They define:

  • Domain entities
  • Entity relationships
  • Business vocabulary
  • Required fields
  • Status lifecycle
  • Reference models
  • Key scenarios
  • API expectations
  • Compliance-sensitive concepts

The model is the foundation for distributed implementation. If the model is unclear, distributed delivery becomes slower and more expensive.


Role 2: Technical Developers Customize UserContext

Technical developers may sit in the platform team or the delivery team, but they should work from a single architecture direction.

Their job is to make CustomUserContext the technical foundation for the project.

They define:

  • Tenant isolation
  • Permission model
  • Internal ID generation
  • Common ID generation
  • Cache strategy
  • i18n strategy
  • Logging and trace IDs
  • Distributed locking
  • Read/write splitting
  • Audit trail
  • Database routing
  • Integration adapters

Example:

public class CustomUserContext extends UserContext {

public String currentTenantCode() {
return currentUser().getTenantCode();
}

public boolean canOperate(String operation, Object target) {
return permissionPolicy().canOperate(currentUser(), operation, target);
}

public void withBusinessLock(String key, Runnable task) {
distributedLockService().executeWithLock(currentTenantCode() + ":" + key, task);
}
}

This makes infrastructure decisions reusable by all delivery developers.


Role 3: Delivery Developers Build Business APIs

Most delivery developers should focus on business delivery.

They should use generated Q and E APIs to:

  • Build reusable query utility functions
  • Implement business services
  • Add controller APIs
  • Compose workflows
  • Apply existing context policies
  • Avoid reinventing infrastructure code

Recommended pattern:

Q/E wrapper function -> Service method -> Controller API

Example query wrapper:

public class CustomerQueryUtil {

public static CustomerRequest visibleCustomers(CustomUserContext userContext) {
return Q.customers().withStatusIsActive()
.filterByTenantCode(userContext.currentTenantCode());
}
}

Example service:

public class CustomerService {

public List<Customer> listVisibleCustomers(CustomUserContext userContext) {
return CustomerQueryUtil.visibleCustomers(userContext)
.orderByNameAscending()
.comment("Query customers").purpose("Load data")
.executeForList(userContext);
}
}

Example controller:

@GetMapping("/customers")
public Object customers(@TQLContext CustomUserContext userContext) {
return customerService.listVisibleCustomers(userContext);
}

1. Model owner or architect defines the domain model
2. TeaQL generates the Java domain API
3. Technical developers customize CustomUserContext
4. Tech lead publishes query/service/controller conventions
5. Delivery developers wrap Q/E into reusable functions
6. Delivery developers implement services and controllers
7. Model owners validate business behavior and model fit
8. Technical reviewers validate context usage and infrastructure safety

Responsibility Boundaries

Work ItemOwner
Domain vocabularyModel owner
Entity modelModel architect
Model reviewModel owner + architect
CustomUserContextTechnical developers
Infrastructure policyTechnical developers
Query utility conventionsTech lead
Business service implementationDelivery developers
Controller APIsDelivery developers
Business acceptanceModel owner
Code consistency reviewTech lead

What Delivery Developers Should Avoid

Delivery developers should normally avoid:

  • Creating their own infrastructure adapters
  • Bypassing CustomUserContext
  • Writing raw SQL for normal domain queries
  • Implementing their own permission logic
  • Creating inconsistent ID generation logic
  • Accessing cache providers directly
  • Adding controller-level business complexity

Instead, they should ask for missing UserContext capabilities or missing reusable query functions.


What Technical Developers Should Provide

Technical developers should provide stable foundations:

  • CustomUserContext methods with clear names
  • Permission helper methods
  • Tenant helper methods
  • Common ID and internal ID generation
  • Locking helpers
  • Cache helpers
  • Audit helpers
  • Read/write routing helpers
  • Logging and trace helpers
  • Example service templates

Good context methods make distributed implementation much safer.


Review Checklist

For model review:

  • Does the model match business vocabulary?
  • Are entity relationships clear?
  • Are status transitions represented correctly?
  • Are required fields and lifecycle rules clear?

For technical review:

  • Does service code use CustomUserContext?
  • Are Q and E expressions wrapped in reusable functions?
  • Are controllers thin?
  • Are permission and tenant checks centralized?
  • Are infrastructure decisions kept out of business services?

For distributed delivery review:

  • Is the API behavior correct?
  • Are query utilities reusable?
  • Is raw SQL avoided?
  • Are services easy to read?
  • Are tests focused on business scenarios?

Why This Works for Distributed Delivery

TeaQL reduces ambiguity between teams:

  • The model is owned by model owners.
  • Generated APIs make the model executable.
  • CustomUserContext centralizes technical policy.
  • Delivery developers can focus on business behavior.
  • Reviewers can inspect readable Q and E expressions instead of low-level SQL and repository code.

This allows large distributed teams to deliver more APIs without multiplying infrastructure inconsistency.


Summary

Distributed Delivery Mode works best when responsibilities are explicit:

  • Model owners model the domain.
  • Platform or delivery-side technical developers customize UserContext and define infrastructure behavior.
  • Delivery developers use Q and E wrapper functions to implement services and controllers that expose APIs.

TeaQL makes this division practical by turning the domain model into a readable Java API and by making CustomUserContext the shared technical foundation.