Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your Search Query Is a Program: Composing Role-Based SQL With the Strategy Pattern

Every business application has this screen somewhere: a table of records, filter boxes above it, and a user who may only see part of the data. The first query is a SELECT with a WHERE on the user's office. Filters arrive one at a time, then a role that sees two offices, then an auditor who sees everything once approved. Eventually the query is a two-hundred-line method nobody wants to touch. Our…

Every business application contains a screen displaying records with filter boxes and user permissions. The initial SQL query starts with a SELECT, followed by a WHERE clause based on the user's office. Filters are added progressively, culminating in roles with varying levels of data visibility. Eventually, the query becomes a lengthy, hard-to-manage method that nobody wants to work on.

The key point is that this query was never just a string; it's application logic with a security boundary. Building it by appending text results in a testable and reviewable process, but it remains as code rather than text. The strategy pattern is employed twice: once to determine what a user can see and another to handle the user's request, neither of which constructs the entire query.

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

Google Search Console Adds Multimodal Reporting for Image-Led Search

Google Search Console has introduced a multimodal search type filter in its Performance reports, giving website owners a new way to see how content surfaces when a Google search begins with an image…

  • Google Search Console adds multimodal reporting for image-led search.
  • Multimodal data available in Performance reports since September 24, 2026.

I Built an Interactive System Design Simulator — Learn by Breaking Things

The Problem Every system design resource teaches the same way: here's a concept, here's a diagram, memorize it. But in real interviews, you need to APPLY these concepts under pressure.

  • Simulator teaches system design principles by fixing issues that arise
  • Starts with single server supporting 100 users, green in color
  • Ends with 10,000,000 users experiencing cascade failure to learn circuit breakers

More from Saturday 26 September →