Okay, let's delve into 1.c Functional vs. Non-Functional Requirements. This is a critical distinction in system design, and you must be able to differentiate between them clearly in an interview.
Functional Requirements:
- Definition: These describe what the system should do. They specify the features, functionalities, and services that the system must provide to its users. They are typically expressed as actions or operations that the system performs.
- Examples:
- "A user should be able to register for an account with an email address and password."
- "The system should allow users to post messages to a timeline."
- "The system should generate a report showing sales data for the past month."
- "The system should allow users to search for products by keyword."
- "A user should be able to add items to a shopping cart."
- Focus: They focus on the specific tasks the user can perform or that the system automates.
- How they are documented: Often described using Use cases, User Stories.
Advertisement
Non-Functional Requirements:
- Definition: These describe how well the system should perform its functions. They specify the qualities, characteristics, and constraints of the system. They are often referred to as "quality attributes" or "-ilities."
- Examples:
- "The system should be able to handle 10,000 requests per second." (Scalability)
- "The system should have an uptime of 99.99%." (Availability)
- "The system should respond to user requests in less than 2 seconds." (Performance)
- "The system should store user data securely, encrypting sensitive information." (Security)
- "The system should be easy to use and navigate." (Usability)
- "The system should be able to run on different operating systems." (Portability)
- "It should be easy to add new features to the system." (Maintainability)
- Focus: They focus on the overall quality and characteristics of the system, rather than specific actions.
- How to Identify them: Look for adjectives and adverbs that describe the system's behavior (fast, secure, reliable, scalable, easy-to-use, etc.).
Why is the distinction important?
- Design Decisions: Functional and non-functional requirements drive different design decisions. Functional requirements dictate what components you need (e.g., a database to store user accounts), while non-functional requirements dictate how those components should be implemented and configured (e.g., choosing a database that can handle the required read/write load).
- Trade-offs: Non-functional requirements often involve trade-offs. For example, increasing security might impact performance. A good system designer understands these trade-offs and can make informed decisions based on the priorities of the project.
- Interview Success: In a system design interview, clarifying both types of requirements is crucial. Failing to address non-functional requirements is a common mistake. You need to demonstrate that you can think beyond just the basic functionality and consider the overall quality and performance of the system.
Advertisement
Example (URL Shortener):
- Functional:
- The system should accept a long URL and generate a short URL.
- The system should redirect users from the short URL to the original long URL.
- The system should allow users to (optionally) create custom short URLs.
- Non-Functional:
- The system should be able to handle millions of URLs. (Scalability)
- The system should have high availability (e.g., 99.99% uptime). (Availability)
- The redirection from the short URL to the long URL should be fast (e.g., less than 100ms latency). (Performance)
- The system should protect against malicious URLs. (Security)
In a system design interview, you would start by asking clarifying questions to understand both the functional and non-functional requirements before you start proposing a design. This is absolutely essential.
Advertisement