SkillByAIOpen interactive version →

Lesson 23 / 25

Common Anti-Patterns

Recognise distributed monoliths, nano-services and other costly mistakes.

Mistakes that cost the most

Distributed monolith: services that must be deployed together, share a database or depend on shared domain libraries; you pay the network cost without gaining independence. Nano-services: services so small that every feature needs many of them and most of the code is plumbing. Entity services: CRUD wrappers per table, making business logic scatter across callers. Chatty services: dozens of synchronous calls per request, adding latency and failure points. Shared database: hidden coupling through tables. Big-bang rewrite: stopping feature work to rebuild everything at once. Microservices for CV: splitting because it is fashionable, without the scale of team or traffic to justify it. Missing platform: no automation or observability, so each service is hand-crafted. Ignoring data: splitting code while leaving all services on one schema. Each anti-pattern has the same root cause: boundaries chosen for technical reasons rather than business capabilities and team ownership.

Spot the anti-pattern

Match each symptom to its name.

symptom                                                        anti-pattern
-------------------------------------------------------------  --------------------
"we deploy all 14 services together every Thursday"            distributed monolith
"adding a field touches user-, user-profile-, user-pref-svc"   nano-services
"order logic lives in 6 callers of the order CRUD service"     entity services
"one page view makes 45 internal HTTP calls"                   chatty services
"billing broke because inventory renamed a column"             shared database
"no features shipped for 18 months during the rewrite"         big-bang rewrite

Cutting a cake along the wrong lines

Cut a layered cake horizontally and every guest gets only icing or only sponge, so everyone must swap pieces to get a proper slice. Cut vertically and each slice is complete. Service boundaries should be vertical slices of business capability.

Quick check: Several services share database tables and must be released together. What is this anti-pattern called?

  • Modular monolith
  • Distributed monolith
  • Strangler fig
  • Backend for frontend
Answer

Distributed monolith — A distributed monolith has the coupling of a monolith with the costs of a distributed system.