DEV Community

Alexandra
Alexandra

Posted on

Stop Hiring a Rocket Scientist to Check If a Box Is Empty

One thing I've been thinking about lately is what trade-offs companies are willing to make in order to market their products as "AI-powered."

A tale as old as 2023

A team needs to validate an email address. Someone asks, "What if we used AI?" Five minutes later there's a model call, an API key, a loading spinner, a monthly bill & somehow Kubernetes got involved. Congratulations, you've successfully turned O(1) into "please wait while we contact the cloud."

This is not an argument against AI. Large language models are highly effective for many categories of problems. The issue is not the technology itself, but its application to tasks that never needed it in the first place, because it's new and shiny and everyone is doing it.

The actual differences

Here's an unglamorous truth: an if statement & an LLM call are not doing the same job. They're built for different kinds of problems, and their differences are greater than people give it credit for.

An if statement runs in a millisecond, costs nothing per call, and gives you the exact same answer every single time for the same input (deterministic). An LLM call, takes real time, costs real money, and can give you a slightly different answer to the exact same question depending on the day, the model version, or the wind direction.

if-statement or AI?

Reach for an if statement (or a regex, or .. or ..) when:

  • The rule is simple and well-defined. "Is this a valid email format?" "Is the cart total over $50?" "Is the field empty?"
  • You need the same input to produce the same output. Billing logic, permission checks, form validation. No your users don't want their invoice total to vary by mood.
  • Performance is important and there is no ambiguity requiring interpretation.

Reach for AI when:

  • The task requires judgement. Summarise an article, classifying open-ended free text into fuzzy categories.
  • The input space is too large or unpredictable. You can't write an if statement for "understand what this customer is actually frustrated about" from a paragraph of free text.
  • Some variability in output is fine, or even desirable. A creative writing assistant that gives the exact same suggestion every time isn't actually that useful.

More examples than you asked for, because this pattern is everywhere

Password strength meter. "At least 8 characters, one number, one symbol" is a rule. Come on. We've been solving this since MySpace was a thing. No model needed, no matter how tempting "AI-powered password feedback" sounds on a feature list.

Flagging a support ticket as urgent. If "urgent" just means "contains the word 'urgent' or 'broken'," that's a keyword check. If "urgent" means understanding the tone, the context, and the severity from a paragraph of a frustrated customer wrote at 2am, that's no longer a keyword problem. That's a language understanding problem.

Discount code validation. "Is this code in our database and not expired?" is a lookup, full stop. Please don't ask a model to check a database for you; that's what the database is for.

Sorting a list by price. Please don't spend $0.002 to rediscover ascending order.

Summarizing 200 pages of meeting notes into three takeaways. A hard to write a rule for. This is a real, appropriate use of a model's judgement.

Writing a product description from a spec sheet. Turning structured facts into natural, readable list is a language task. This is AI doing what it's actually good at.

The cost of choosing the wrong tool

This isn't just a complaint about over-engineering. Reaching for AI on an if-statement problem has real costs:

  1. Latency you didn't need to add. A local computation becomes a network request with inference time.
  2. Money you didn't need to spend. Each inference incurs a monetary cost that accumulates with usage. We've somehow managed to invent a subscription for if.
  3. Unpredictability you didn't ask for. If your business logic can quietly behave differently for the exact same input, you've turned a deterministic system into a probabilistic one. Now you get to debug "why did this work yesterday and not today" for a rule that used to just... work.
  4. A dependency you didn't need. Functionality becomes dependent on the availability, performance, and pricing of third-party AI services.

Reflect on our choices

Before reaching for AI, ask: could I write this rule down in a sentence, and would that sentence still be true tomorrow? If yes, you probably want an if statement, not a model call. If the honest answer is "well, it depends, there's a lot of nuance, it's hard to actually pin down," that's usually the signal that you've found a problem AI is actually good at.

AI earning its place in a product should feel like reaching for a tool that's uniquely suited to a hard problem, not like a reflex applied to everything because it's the exciting new thing to reach for.

Sometimes the most sophisticated piece of technology in the room is the engineer who knew not to call the model.

Resources

Top comments (0)