Skip to content
Theory · Requirements and estimates · lesson 2 of 8

Functional requirements

Functional requirements say what a system does. Picture a restaurant menu: it lists what is cooked here, but not how fast a dish arrives or how many guests fit in the room. The menu is the functional requirements, while speed and capacity are requirements of another kind.

The analogy breaks in one place: the restaurant writes its own menu, while the requirements of a system are yours to find out from the interviewer. You also decide which of them to design.

How to write them

A functional requirement is an action the system performs for a user or another system. Each is written as one line in the form "who does what":

  • "a user publishes a post with 3 photos";
  • "a user follows an author";
  • "a user sees posts of the people they follow, newest first".

Such a line answers two questions: who acts and what comes out of it. Later each becomes an API call and a request path on the diagram.

Write the action, not the mechanism. "A user sees the feed" is a requirement. "The feed is kept in a cache" is already a decision, made later, once the load is known.

Core and secondary

The interviewer may list a dozen features: comments, likes, stories, messages, ads. You cannot design them all in 45 minutes. Pick the 3–5 core ones the product cannot exist without, and ask the interviewer whether they agree.

For the photo feed the core ones are:

  1. Publish a post with photos.
  2. Follow authors.
  3. View the feed of followed authors.
  4. Search for people by name.
  5. Get a notification about a new post from a followed author.

The order matters too. The first three are the core of the product: without them there is no photo feed. Search and notifications are useful, but if time runs out you can describe them in words.

What stays out of scope

Name the rest out loud and set it aside: comments, likes, stories, direct messages, recommendations, ads. This way the interviewer sees that you did not forget them but narrowed the problem on purpose.

If they want to return to something from that list, they will say so at the end. If you stay silent, they may decide you did not think about likes.

A requirement changes the design

Each core requirement adds a block or a request path to the diagram. Publishing and the feed sit on a service and a database. The last two requirements work differently:

  • searching by part of a name, even with a typo, is hard for an ordinary database: a query like "name contains 'ann'" scans every row;
  • a notification may go out a minute later, so it does not have to be sent at the moment of publishing.

Try to carry these conclusions over to the diagram.

Sketch

Requirements: publish a post, search 500 million profiles by part of a name even with a typo, and notify followers of a new post — a delay of up to a minute is fine. Add what the last two requirements cannot work without, and connect the blocks.

The queue here separates publishing from sending. The message brokers course explains in detail how a call differs from a message, in the lesson Calls and messages. In an interview it is enough to say that a notification can wait and to name the cost: if the worker falls behind, notifications arrive later.

Common mistake

Designing everything the interviewer mentioned. The candidate takes on comments, likes and stories at once, and by minute forty has not shown how the feed itself works. The interviewer sees many blocks and not one path thought through. Pick the core, agree on it with the interviewer, and finish it.

Key points

  • A functional requirement is an action of the system, written as one line "who does what".
  • Out of a dozen features you pick 3–5 core ones and agree on them with the interviewer.
  • The rest is named out loud and set aside.
  • Each requirement adds a block or a path: search by part of a name needs a search index, deferred notifications need a queue and a worker.