06 Anti Patterns And Technical Debt

Anti-Patterns And Technical Debt

Klok accepts tactical compromises, but some designs create more risk than value.

Database Reach-Around

A service reads directly from another service's database to save time.

Why it is forbidden:

  • Breaks service ownership.
  • Couples to private schema.
  • Bypasses audit and access patterns.
  • Fails when the owning system changes its database.

Let the owning system publish what others need on the broker, or use its API or an owned data model instead.

God Topic

A topic carries unrelated event types to avoid creating proper topics.

Why it is forbidden:

  • Kills type safety.
  • Forces consumers to inspect payloads blindly.
  • Breaks impact analysis.
  • Hides ownership and contract meaning.

Create meaningful topics tied to data models and event purposes.

Filtering A Shared Topic

Several processes use the same datamodel, all of it goes on one topic, and each consumer receives every message and throws away those that are not its own, often after a lookup per message.

Why it is costly:

  • Every consumer pays for every other flow's volume, and a burst in one flow delays all the others.
  • The rule for which messages belong to whom is hidden in consumer code instead of in the topic name.
  • Access cannot be granted for one flow without granting all of them.

Give each flow a topic purpose that producer and consumer agree on (see Topic Purpose). The datamodel and its type safety stay the same.

Raw Class X On The Broker

Raw vendor payload is published as if it were the shared integration contract between systems. A class X model may be sent over the broker; the anti-pattern is using it, or an unmodeled payload, as the common language that other systems and domains depend on.

Why it is dangerous:

  • Couples consumers to the source system.
  • Makes schema changes unpredictable.
  • Pollutes the context graph.
  • Pushes mapping responsibility downstream.

Use onramp transformation or a clearly tagged tactical wrapper. A channel adapter that receives Class X with minimal handling, read only by the leg of the same flow that maps it, is not this anti-pattern when the solution document says why (for example so that no inbound mail is lost while a product is redeployed); see Ingress, egress, onramp and channel adapter.

Local State In Processing Legs

A processing route stores important state in memory.

Why it is forbidden:

  • Kubernetes can restart the pod.
  • Consumers can rebalance.
  • Another instance may process the next event.
  • State disappears during failure.

Use the message payload, broker semantics, or a persistent store designed for the need.

Unreviewed AI Publishing

AI-generated changes are published without human review.

Why it is forbidden:

  • AI has no production accountability.
  • It may miss security, ownership, and operational context.
  • It can generate plausible but incorrect transformations.

Keep AI suggestions reviewable, scoped, and traceable.

Debt Management

Technical debt is acceptable only when named and owned. A tactical decision should have:

  • Reason.
  • Owner.
  • Risk.
  • Monitoring signal.
  • Review date.
  • Retirement condition.