Urgent.News

What's breaking now, across thousands of outlets.

Tech

Keeping Services Loosely Coupled Without Making Everything Abstract

Loose coupling is one of those things everyone agrees with until they have to do it. Then it turns into a mess of interfaces, event buses, and six layers of indirection for a feature that just sends an email. I've built both kinds of systems: tightly coupled ones that were fast to write and painful to change, and over-abstracted ones that were painful to write and still painful to change. Here's…

Loose coupling is often praised, but it can become a complex web of interfaces, event buses, and unnecessary layers for simple tasks like sending emails. The author has experience with both tightly coupled and overly abstracted systems, and has found a middle ground. Coupling isn't a binary yes or no question; it depends on what changes together and how often.

Services are tightly coupled if a change in one necessitates coordinated changes in the other. The aim isn't to eliminate coupling altogether, but rather to match the coupling to the rate of change. Services should connect through a stable contract rather than each other's internals. For instance, rather than a consumer knowing the producer's database columns, the producer should expose a contract class.

When the producer adds a new column, the consumer remains unaffected. This sounds straightforward, but many services still reach into each other's tables for faster performance. Prefer asynchronous messages for cross-service operations as synchronous calls can create a chain of failures. If service A calls B, and C, and C goes down, A also goes down.

Async messaging breaks this chain, allowing services to operate independently and not needing to be up simultaneously. Synchronous calls are necessary when an immediate response is required. Contracts and APIs should be versioned from the beginning. Additive changes are safe, but breaking changes need a new version. Never reuse a field as it can lead to silent bugs.

Sharing a database is a major source of hidden coupling. Two services on the same schema cannot be deployed or scaled independently. Extract tables one at a time, creating an API for each, migrating readers, then writers. Although it's slow, it's reversible. Loose coupling isn't a goal to be achieved once and then forgotten. It's a property to be maintained consistently, like performance or readability.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Digital Sovereignty: Europe's Path to Infra-Independence

Digital sovereignty in the EU: From slogan to practice We're surfing on the wrong server. That's one of the harshest realities we're facing as IT professionals today.

  • "Digital Sovereignty" in EU discussed as political slogan, but operational challenge
  • US-CLOUD Act allows US authorities to demand data access regardless of data center location
  • EU initiatives DGA and GAIA-X aim to create framework for sovereign data markets

Production API Key Rotation Explained: 6 Least-Privilege Checks for Node.js GitHub Actions

Short answer: use two narrowly scoped API keys, switch traffic with an explicit activation step, and revoke the old key only after logs and live requests prove the cutover.

  • Rotate production API keys in Node.js GitHub Actions to reduce security risks
  • Use two narrowly scoped keys with explicit activation for traffic switch
  • Revoke old key after verification to minimize downtime and prevent disruptions

Mastering Advanced Server-Side Caching Patterns in Next.js 14

Originally published on tamiz.pro . In modern React architectures, the distinction between client-side and server-side execution is no longer just about where the code runs; it is about where the data…

  • Default caching in Next.js has limitations and requires custom solutions
  • Implement fine-grained memoization to cache individual data slices
  • Use Stale-While-Revalidate pattern with ETag headers for optimized data fetching

Medicine Safety Gatekeeper: Building a Real-Time Drug Interaction & Expiration Checker with YOLOv10

We’ve all been there: digging through a cluttered medicine cabinet, wondering if that half-empty blister pack of Ibuprofen is still safe to take, or if it will play nice with the cold medicine you…

  • AI-powered Medicine Safety Gatekeeper uses YOLOv10 for medicine container detection.
  • Tesseract OCR extracts expiration dates and ingredients from medicine images.
  • System checks extracted data against SQLite database for expired products and drug interactions.

Never Miss Twice: What 2,066 Habits Say About the Second Day

TL;DR. I measured the "never miss twice" rule against 2,066 real habits from 1,006 people. Once a habit has one missed day behind it, 80.9% of those gaps still end with a check.

  • "Never miss twice" rule suggests missed habits become harder to resume.
  • 80.9% of habits resumed after one missed day, 71.1% after two.
  • Return rate decreases sharply with each additional missed day.

More from Sunday 13 September →