liveBook · Manning

Lean communication

As explained in The Art of Code

Lean communication is a software pattern that minimizes unnecessary data transmitted between system components.

Lean communication minimizes network traffic by reducing both remote-call frequency and transferred data. It treats every request as more than its payload: a client-to-server exchange also activates network infrastructure and carries fixed protocol overhead. The result is lower bandwidth and electricity use, alongside more efficient client–server interaction. section 8.4.4 section 8.6

Start with the interaction rather than the endpoint list. When one page needs customer details and orders, a single endpoint containing the needed information can be preferable to two separate calls. The payload may be the same size, but consolidating the exchange avoids repeating request overhead such as TCP/TLS handshakes and HTTP headers. section 8.4.4

Reduce unnecessary communication with context-sensitive choices:

  • Design APIs around the information a client actually needs, avoiding separate calls when one response can serve the interaction. section 8.4.4
  • Cache at the appropriate layer—browser memory, HTTP intermediaries, CDN, server, or database—and define expiration rules that fit how often data changes. section 8.4.4
  • Use offline-first behavior for suitable workflows: retain recently used data and user actions locally, synchronize in the background, and batch updates instead of calling remotely for every small interaction. section 8.4.4
  • Choose polling or push-based updates deliberately rather than repeatedly requesting changes by default. section 8.4.4

Inspect the response shape

A customer response can combine identity, contact details, address, orders, and preferences. Before sending such a response, compare its fields with the current screen’s needs. Lean communication favors grouping required data for an interaction while avoiding oversized payloads and needless requests. section 8.4.4

<customer>
  <id>48291</id>
  <name>Emily Doe</name>
  <email>emily.doe@example.com</email>
  <phone>+1-555-0143</phone>
  <address>
    <street>281 Main Street</street>
    <city>Springfield</city>
    <state>CA</state>
    <country>USA</country>
  </address>

  <orders>
    <order>
      <id>10293</id>
      <total>129.90</total>
    </order>
    <order>
      <id>10212</id>
      <total>54.00</total>
    </order>
    <order>
      <id>9912</id>
      <total>260.45</total>
    </order>
  </orders>

  <preferences>
    <newsletter>true</newsletter>
    <language>en-US</language>
    <theme>light</theme>
  </preferences>
</customer>

Use this customer payload to identify fields that may be unnecessary for a particular interaction and to discuss response shapes that combine only required information. section 8.4.4

Efficiency is not an instruction to optimize blindly. Communication improvements sit among broader green patterns that also address package size, storage, CPU work, memory use, and carbon intensity. Review visible signals such as oversized payloads, inefficient queries, and unbounded caches, then favor the smallest safe improvement that preserves understandable software and leaves the final decision to the developer. section 8.5.2 section 8.6

How The Art of Code covers it

How deep it goes
Explains API consolidation, layered caching, offline-first batching, and update choices, without prescribing a universal optimization rule.
Examples
Uses a customer-and-orders endpoint scenario and a customer payload containing contact, address, orders, and preferences.
What it assumes
Assumes familiarity with client–server requests and introduces communication-saving practices through concrete API and caching decisions.
What you can do after
Evaluate/understand which requests, cache tiers, response fields, and synchronization behaviors create avoidable network traffic.
How it connects
Connects API design, HTTP caching, CDN caching, offline-first design, polling, push updates, and client–server interactions.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of Code. The section links point to the parts of the book it draws on.