Plumbing

It’s the code you write which isn’t specific to the actual purpose of a service, but which is necessary in order to operate your software in production. Code which does things like:

  • establishing connectivity to infrastructure such as databases, message buses, event queues, and so on
  • figuring out the URL for a dependent service (i.e. service discovery)
  • logging, instrumentation and observability for your service
  • retrieving configuration values
  • determining the state of a feature flag
  • defining the contents and boot procedure for your service’s container
  • and so on…

Basically, plumbing is any code or configuration that serves the technical aspects of operating a service, rather than the business domain of your service. All of this plumbing is necessary, but it’s unrelated to the product features your service is built to provide. It’s accidental complexity, rather than essential complexity.

In contrast, business logic is the code which implements that actual valuable functionality of a service. For a Shopping Cart service it’s the code which keeps track of what products are in a cart. For a Shipping service it’s the code which figures out which shipping options are applicable for a given set of purchased products, and how much each shipping option would cost.

In Hexagonal Architecture terms, the plumbing is all the “ports and adapters” stuff at the edges of the service’s implementation, while the business logic lives in the chewy central domain.