Functional vs. Non-Functional Requirements
In system design, requirements describe what a system must do and how well it must perform. They are divided into two main categories: functional requirements (FRs) and non-functional requirements (NFRs). Functional requirements define the system's features and behavior, while non-functional requirements define its quality attributes, constraints, and operational expectations.
A user can register, log in, and reset a password.
A user can search for coding problems by topic and difficulty.
A user can submit code for execution and receive a verdict.
A payment system can authorize payments, process refunds, and maintain transaction records.
An e-commerce system can add products to a cart and place orders.
Performance: 95% of search requests should complete within 200 milliseconds.
Scalability: The system should support 100,000 concurrent users.
Availability: The service should target 99.99% availability.
Reliability: Accepted code submissions should not be lost if a worker crashes.
Security: Untrusted user code must execute in an isolated environment with restricted permissions.
Consistency: A successful payment must not be charged twice because of retries.
Maintainability: Components should have clear responsibilities and well-defined interfaces.
Durability: Confirmed order records must survive application and machine failures.
Good NFRs should be measurable and testable. Instead of saying 'the system should be fast,' specify a latency target, percentile, workload, and measurement conditions. For example: 'Under 5,000 requests per second, 95% of product-search requests should complete within 200 ms.'
Example: For a LeetCode-like platform, functional requirements include browsing problems, submitting code, running test cases, and viewing results. Non-functional requirements include low submission latency, high availability, secure execution of untrusted code, and the ability to handle submission spikes.
In an interview, clarify the most important functional requirements first, then establish the key NFRs and their targets. Functional requirements determine the capabilities and main components; NFRs heavily influence architectural choices such as caching, replication, queues, database selection, isolation, and deployment topology.
0-2 years experience
2-5 years experience
5-8 years experience
8+ years experience