Requirements
Introducido
6:03
Ingeniería de software
Software engineering is how systems outlive their authors. The first three units shape the product: requirements, architecture and interface design. The next…
Narración en inglés · subtítulos en inglés y 中文 que puedes cambiar
En esta lección
| English | Significado |
|---|---|
| Requirements engineering/rɪˈkwaɪəmənts ˌendʒɪˈnɪərɪŋ/ | finding out, writing down and checking what a system must do |
| requirement/rɪˈkwaɪəmənt/ | |
| functional requirement/ˈfʌŋkʃənl rɪˈkwaɪəmənt/ | requisito funcional |
| non-functional requirement/nɒn ˈfʌŋkʃənl rɪˈkwaɪəmənt/ | requisito no funcional |
| use case/juːs keɪs/ | caso de uso |
| acceptance test/əkˈseptəns test/ | A test that checks whether a system meets the user's agreed requirements. |
| Availability/əˌveɪləˈbɪlɪti/ | Whether a resource can be obtained when and where it is needed. |
| acceptance criterion/əkˈseptəns kraɪˈtɪərɪən/ | a condition, often written Given-When-Then, that a feature must meet to count as done, checkable by a test |
| percentile/pəˈsentaɪl/ | A value marking a specified percentage of observations at or below it in an ordered distribution. |
Qué y qué tan bien
- Ingeniería de requisitos: un requisito funcional dice qué hace el sistema ("un miembro puede tomar prestados hasta 5 libros"); un requisito no funcional dice cómo de bien ("la búsqueda responde dentro de 2 s"). Un caso de uso recorre un objetivo de extremo a extremo con sus actores.


Search answers within 2 seconds is —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
It constrains how well the searching works, not what exists.
Formulación verificable
- "Fácil de usar" no puede fallar una prueba. "Un nuevo miembro completa su primer préstamo en menos de 3 minutos sin ayuda (medido con 5 usuarios de primera vez)" — ahora existe un criterio de aprobación/rechazo.
- Lista de cursos: FR-1 límite 5 (sexto préstamo rechazado); FR-2 vencimiento = fecha + 21; FR-3 un recordatorio por día de retraso; NFR-1 búsqueda p95 bajo 2 s en 10 000 títulos. Cada uno se mapea a una prueba de aceptación por nombre.
A requirement is testable when —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Observable outcome = a verdict exists: pass or fail.
"Search must be fast" is a testable non-functional requirement.
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
"Fast" has no number, so no test can fail it. "Search returns in under $2$ s at the 95th percentile on $10\,000$ titles" can.
El rastro al código
- Requisito $\to$ prueba de aceptación $\to$ prueba roja $\to$ motivo del próximo commit: la cadena es auditable; un commit que cierra FR-2 así lo indica.
- Cuidado con los errores: solución dentro de requisitos ("usar Redis" — la necesidad, no el medio); adjetivos no medibles; suposiciones silenciosas (el periodo de 21 días es una constante nombrada, no un folklore).
A commit that closes FR-2 must say so because —
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
The auditable chain is what makes the history trustworthy.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Numbers in non-functional requirements
- Non-functional requirements need numbers, and the numbers have costs. Availability 可用性 of $99.9\%$ allows $8\,760 \times 0.001 = 8.76$ hours of downtime a year; $99.99\%$ allows only $53$ minutes, and each extra nine usually means extra servers and staff on call.
- Prioritise before building: MoSCoW sorts requirements into must, should, could and won't (this time). A change, such as cutting the loan period from $21$ to $14$ days, is then traced through its row in the matrix: one named constant, one acceptance test, nothing else.
A service promises 99.95% availability. How many hours of downtime does that allow per year (8760 hours)?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
8760 x 0.0005 = 4.38 hours.
Which is a non-functional requirement?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
It says how well the system performs, with a measurable number.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Given, when, then
- An acceptance criterion 验收标准 in Given–When–Then form is a test written before any code: Given a member holding 5 loans, when they borrow another copy, then the system refuses and shows the limit.
- Each part fixes one thing: the starting state, the action and the result you can observe. "The system handles limits sensibly" fixes none of them.
Which is a testable acceptance criterion?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
It fixes the state, the action and the observable result; the last one is a solution, not a need.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Worked example: why percentiles, not means
- Ten search times in ms: 120, 150, 180, 200, 220, 250, 300, 400, 900, 2500. The mean is $5220/10 = \mathbf{522}$ ms, which looks fine, yet one member waited 2.5 s.
- The 90th percentile 百分位数 by nearest rank is the $\lceil 0.9 \times 10 \rceil = 9$th value, 900 ms. A requirement such as "p95 under 2 s" says how many users may wait, and for how long; a mean says neither.
Search times 120, 150, 180, 200, 220, 250, 300, 400, 900, 2500 ms: mean (ms)?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
$5220/10 = 522$.
Same ten times: 90th percentile by nearest rank (ms)?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
El $\lceil 0.9 \times 10 \rceil = 9$th sorted value.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Worked example: rewrite three weak requirements
- Each draft below fails in its own way. Rewrite it so a test can pass or fail.
| Weak draft | Testable rewrite |
|---|---|
| "Search should be fast." (an adjective) | 95% of searches over 10 000 titles return in under 2 s |
| "Use Redis to cache searches." (a solution) | a repeated search returns in under 200 ms |
| "Members must not keep books too long." (vague) | a book borrowed on 1 March shows a due date of 22 March |
- Each rewrite names a number or an observable result, and none of them says how to build it.
Which is the best rewrite of "The system should be reliable"?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
It gives a number and a way to measure it, so it can pass or fail. "Two servers" names a solution, not the need.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Marks that slip away
- The solution inside the requirement 需求. "Use Redis" is a means; state the need, such as search under $2$ s.
- Adjectives instead of numbers. "Fast" and "easy" cannot fail a test.
- Hidden assumptions. Write the 21-day loan period down, or two teams will assume different ones.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
Recap
- Functional: what the system does; non-functional: how well, with a number.
- Testable wording can pass or fail: "under 3 minutes for 5 first-time users".
- Requirement → acceptance test 验收测试 → commit: the trace can be audited.
¿Qué salió mal? Solo el equipo del sitio ve esta información.