requirements-engineering

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Requirements Engineering

需求工程

Structured approaches for capturing what to build before how to build it.

在确定如何构建之前,先通过结构化方法明确需要构建的内容。

Core Principle

核心原则

Specify WHAT, not HOW. Requirements describe outcomes and behaviors, not implementation details.

明确「要什么」,而非「怎么做」。 需求描述的是结果和行为,而非实现细节。

EARS Format

EARS格式

Easy Approach to Requirements Syntax - structured acceptance criteria.
PatternTemplateUse Case
Event-drivenWHEN [event] THEN [system] SHALL [response]User actions, triggers
ConditionalIF [condition] THEN [system] SHALL [response]Business rules
State-drivenWHILE [state] [system] SHALL [response]Ongoing behaviors
UbiquitousWHERE [feature] [system] SHALL [response]Always-true rules
Unconditional[system] SHALL [response]Basic capabilities
Easy Approach to Requirements Syntax(需求语法简易方法) - 结构化的验收标准。
模式模板使用场景
事件驱动型WHEN [事件] THEN [系统] SHALL [响应]用户操作、触发条件
条件型IF [条件] THEN [系统] SHALL [响应]业务规则
状态驱动型WHILE [状态] [系统] SHALL [响应]持续行为
通用型WHERE [功能] [系统] SHALL [响应]始终生效的规则
无条件型[系统] SHALL [响应]基础功能

Examples

示例

TypeExample
EventWHEN user clicks "Submit" THEN system SHALL validate all required fields
ConditionalIF user is not authenticated THEN system SHALL redirect to login
StateWHILE file is uploading system SHALL display progress indicator
UbiquitousWHERE data is displayed system SHALL use consistent date format

类型示例
事件驱动WHEN 用户点击“提交”按钮 THEN 系统 SHALL 验证所有必填字段
条件型IF 用户未通过身份验证 THEN 系统 SHALL 重定向至登录页面
状态驱动WHILE 文件正在上传 系统 SHALL 显示进度指示器
通用型WHERE 展示数据时 系统 SHALL 使用统一的日期格式

User Story Format

用户故事格式

As a [role]
I want [capability]
So that [benefit]
As a [role]
I want [capability]
So that [benefit]

Good vs Bad

正面示例 vs 反面示例

BadGood
As a user I want to loginAs a returning customer I want to login with my email so that I can access my order history
As a user I want a buttonAs a content creator I want a publish button so that I can share my work publicly
Key concept: The "so that" clause reveals the actual need - often the stated "want" isn't what's really needed.

反面示例正面示例
作为用户,我想要登录作为回头客,我希望通过邮箱登录,以便查看我的订单历史
作为用户,我想要一个按钮作为内容创作者,我希望有一个发布按钮,以便公开分享我的作品
核心概念:“So that”部分揭示了真实需求——通常用户表述的“想要”并非真正的需求。

Requirements Document Structure

需求文档结构

SectionContent
Problem StatementWhat problem are we solving?
User StoriesWho wants what and why?
Acceptance CriteriaHow do we know it's done? (EARS)
Non-FunctionalPerformance, security, accessibility
Out of ScopeWhat we're NOT building
Success MetricsHow do we measure success?

章节内容
问题陈述我们要解决什么问题?
用户故事谁想要什么,以及为什么?
验收标准我们如何判断功能已完成?(采用EARS格式)
非功能性需求性能、安全性、可访问性
范围外内容我们不会构建的内容
成功指标我们如何衡量成功?

Constitution (Governing Principles)

指导准则(管理原则)

For complex projects, establish guiding principles before features:
ElementPurpose
Core ValuesWhat matters most (simplicity > cleverness)
Technical PrinciplesArchitecture standards
Decision FrameworkHow to make trade-offs
Quality StandardsTesting, review requirements
Key concept: Constitution prevents scope creep and ensures consistency across features.

对于复杂项目,在确定功能之前先建立指导原则:
要素目的
核心价值观最优先的事项(例如:简洁 > 精巧)
技术原则架构标准
决策框架如何进行权衡取舍
质量标准测试、评审要求
核心概念:指导准则可防止范围蔓延,并确保各功能之间的一致性。

Clarification Techniques

澄清技巧

Before implementation, resolve ambiguities:
TechniqueWhen to Use
Ask "what if"Edge cases, error scenarios
Present optionsMultiple valid approaches
Challenge assumptions"Is this actually required?"
Define boundariesWhat's in/out of scope
在实现之前,解决模糊点:
技巧使用场景
提出「如果…会怎样」的问题边缘情况、错误场景
提供备选方案存在多种有效实现方式时
挑战假设质疑“这真的是必需的吗?”
定义边界明确哪些内容在/不在范围内

Questions to Ask

可提出的问题

  • What happens when [edge case]?
  • What does success look like?
  • What's the minimum viable version?
  • What can we defer to later?

  • 当出现[边缘情况]时,会发生什么?
  • 成功的标准是什么?
  • 最小可行版本包含哪些内容?
  • 哪些内容可以延后实现?

Non-Functional Requirements

非功能性需求

CategoryQuestions to Answer
PerformanceResponse time? Throughput? Concurrent users?
SecurityAuthentication? Authorization? Data protection?
AccessibilityWCAG level? Screen reader support?
ScalabilityExpected growth? Peak load?
ReliabilityUptime requirements? Recovery time?

类别需要回答的问题
性能响应时间?吞吐量?并发用户数?
安全性身份验证?授权?数据保护?
可访问性WCAG级别?屏幕阅读器支持?
可扩展性预期增长?峰值负载?
可靠性可用时间要求?恢复时间?

Anti-Patterns

反模式

Don'tWhy
Specify implementation"Use React" locks in decisions
Assume requirementsValidate with stakeholders
Skip edge casesThey become bugs later
Mix requirements with designConflates what with how
Write vague criteria"System should be fast" is untestable

不要做什么原因
指定实现细节例如“使用React”会锁定决策
假设需求的合理性需与相关方验证
忽略边缘情况后续会演变为bug
混淆需求与设计将「要什么」和「怎么做」混为一谈
编写模糊的标准例如“系统应快速”无法测试

Testable vs Untestable

可测试 vs 不可测试

UntestableTestable
"Fast response""Response under 200ms"
"User-friendly""Task completable in <3 clicks"
"Secure""Passwords hashed with bcrypt"
"Scalable""Handles 10K concurrent users"
Key concept: If you can't write a test for it, it's not a requirement - it's a wish.
不可测试可测试
“响应快速”“响应时间低于200毫秒”
“用户友好”“任务可在3次点击内完成”
“安全”“密码使用bcrypt加密”
“可扩展”“可支持10000并发用户”
核心概念:如果无法为某项要求编写测试用例,那它就不是需求——只是一个愿望。