TweakCode
Design Method lessons

Requirements · Stage 1 of 3

Functional & Non-Functional Requirements

Turn user verbs and measurable qualities into a list the design must satisfy

Foundations

A system design starts from requirements, not boxes. Functional requirements are the verbs users perform, each with an observable result, such as create an item or fetch it. Non-functional requirements are the qualities those verbs must keep, stated as numbers: a latency target such as 50 ms, an availability such as 99.9%, a durability rule such as never lose a write.

Requirements also decide what is not built. Test each tempting extra against the busiest request path: if it adds work to every call of the hottest verb, such as a write on every read, it is a real cost that needs an explicit decision. Writing declined extras on an out-of-scope list keeps the design honest about what it answers.

Take a service with two verbs, create(item) and get(id). Its quality lines might read: get under 50 ms, items never lost, 99.9% availability. A request to count every get sounds small, but it adds a write to the hottest call, so it goes on the out-of-scope list unless someone accepts that cost.

create · getread · writeUserServiceStoredurableCounterout of scope
Two verbs reach the service, and the store must keep every write. The counter would add a write to every read, so it waits on the out-of-scope list.

Case Scenario

The design brief

Scope a URL shortener

Design a service that turns a long URL into a short link and sends visitors to the original address.

To see how requirements shape a design before any box is drawn, consider a URL shortener like bit.ly: an owner turns a long URL into a short code, and a visitor opening that code is redirected to the original address. Creating and redirecting are the verbs; redirects under 50 ms and never losing a mapping are the qualities, and click counts are the tempting extra.

A shortener begins with two small user actions, but one extra sentence can change the busiest request. If “show click counts” is accepted casually, every redirect gains work that was never budgeted; custom domains and abuse detection widen the design again. The team needs a firm boundary: create and redirect are in scope, redirects stay under 50 ms, mappings are durable, and click counts must not add a write to the redirect path.

Step by step

Walkthrough

Same scenario, now one decision at a time. Each frame changes one part of the design.

  1. 1.Write four to six functional requirements as user-visible verbs.
  2. 2.Give each quality a number or a failure rule.
  3. 3.For each tempting extra, name the box or write it would add.
  4. 4.Put the extras you decline on an explicit out-of-scope list.

Step through

Scope a URL shortener

create · openUserAPIMappings

Two verbs are the product: create a short link, and open it. Each is one call to the API and touches one stored mapping.

1 / 5

The Pattern

For this shortener, scope create and redirect, require redirects under 50 ms and durable mappings, and defer click counts, custom domains, and abuse detection; click counts are the request that threatens a write on every redirect.

Treat each user action as a functional requirement: an owner creates a short link and a visitor opens it. State observable results and failures, not components. The redirect target is under 50 ms, mappings are never lost, and availability gets a number such as 99.9%.

Pressure-test extras against the request path. Click counts require work on every open, while custom domains and abuse detection introduce separate concerns. Record those as non-goals so the finished design answers the agreed problem and each boundary can be revisited explicitly.

What you leave with

Functionalcreate, redirect

Non-functional< 50 ms, durable

A list this short fits a 45-minute design. Each number should be one a reviewer could argue with, such as 50 ms or 99.9%, because those are the numbers that later decide caches, replicas, and queues.

When to use this in an interview

  • The prompt is open-ended, and scope must be agreed before designing.
  • A feature request would add work to the busiest path.
  • Qualities such as latency or availability have no numbers yet.

In production

Service level objectives at Google

Google's SRE practice writes non-functional requirements as service level objectives: measurable targets such as 99.9% of requests served in under 100 ms over 30 days. The gap between the target and perfection is an error budget the team may spend on releases. Like the walkthrough's list, each number is one a reviewer can check, which is what makes it a requirement rather than a wish.

Where this breaks

Listing verbs scopes one request path. It does not size the system, and a cheap verb can still dominate storage.

Your turn

Design it yourself

You have watched verbs, numbered qualities, and non-goals become one checklist. Now write your own in the drill, Scope a URL shortener, before you draw any box.

  1. 1

    Scope a URL shortener

    Guided · the brief you just walked through

    Design it

Finished this lesson?

Mark it complete when you are ready to move on.