Standards and Methodology References
You are here: Main Guide → Resources → Standards
Quick Navigation
- Apply EARS: Requirements Phase - Use EARS format in practice
- Use Template: Requirements Template - EARS-formatted template
- See Examples: Simple Feature Specs - EARS in action
- More Tools: Tools & Resources - Additional helpful resources
This section provides detailed information about industry standards, methodologies, and best practices that inform the spec-driven development approach.
EARS (Easy Approach to Requirements Syntax)
EARS is a structured approach to writing requirements that makes them clear, testable, and unambiguous. It uses specific keywords to define different types of requirements.
EARS Keywords and Structure
WHEN (Event-driven requirements)
Used for requirements triggered by specific events or conditions.
Format: WHEN [event/trigger] THEN [system] SHALL [response]
Examples: - WHEN a user clicks the "Save" button THEN the system SHALL validate all form fields - WHEN a file upload exceeds 10MB THEN the system SHALL display an error message - WHEN a user session expires THEN the system SHALL redirect to the login page
IF (State-driven requirements)
Used for requirements that depend on specific system states or conditions.
Format: IF [condition] THEN [system] SHALL [response]
Examples: - IF a user is not authenticated THEN the system SHALL deny access to protected resources - IF the database connection fails THEN the system SHALL display a maintenance message - IF a user has admin privileges THEN the system SHALL show the admin panel
WHILE (Continuous requirements)
Used for requirements that must be maintained during ongoing operations.
Format: WHILE [condition] [system] SHALL [continuous behavior]
Examples: - WHILE a file is uploading the system SHALL display a progress indicator - WHILE a user is typing the system SHALL provide real-time validation feedback - WHILE the system is processing a request the system SHALL prevent duplicate submissions
WHERE (Optional requirements)
Used for requirements that apply only in specific contexts or locations.
Format: WHERE [location/context] [system] SHALL [behavior]
Examples: - WHERE the user is on a mobile device the system SHALL use responsive layout - WHERE the application runs in production mode the system SHALL log errors to external service - WHERE multiple users edit simultaneously the system SHALL handle conflicts gracefully
EARS Best Practices
- Use Active Voice: Write requirements using active voice for clarity
- Be Specific: Avoid vague terms like "user-friendly" or "fast"
- One Requirement Per Statement: Each EARS statement should contain exactly one requirement
- Testable Outcomes: Every requirement should be verifiable through testing
- Consistent Terminology: Use the same terms throughout all requirements
EARS Anti-Patterns to Avoid
- Compound Requirements: Avoid multiple SHALL statements in one requirement
- Vague Conditions: Don't use unclear triggers like "when appropriate"
- Implementation Details: Focus on what, not how
- Untestable Requirements: Avoid subjective terms that can't be measured
System Design and Architecture Best Practices
Architectural Principles
SOLID Principles
- Single Responsibility: Each module has one reason to change
- Open/Closed: Open for extension, closed for modification
- Liskov Substitution: Subtypes must be substitutable for base types
- Interface Segregation: Clients shouldn't depend on unused interfaces
- Dependency Inversion: Depend on abstractions, not concretions
Design Patterns
- Creational: Factory, Builder, Singleton
- Structural: Adapter, Decorator, Facade
- Behavioral: Observer, Strategy, Command
Architectural Styles
- Layered Architecture: Separation of concerns through layers
- Microservices: Distributed system of small, independent services
- Event-Driven: Components communicate through events
- Hexagonal: Isolates core logic from external concerns
System Design Methodologies
Domain-Driven Design (DDD)
- Ubiquitous Language: Shared vocabulary between technical and domain experts
- Bounded Contexts: Clear boundaries around domain models
- Aggregates: Consistency boundaries for business rules
- Domain Events: Capture important business occurrences
Clean Architecture
- Independence: Framework, database, and UI independent
- Testability: Business rules can be tested without external elements
- UI Independence: UI can change without changing business rules
- Database Independence: Business rules not bound to database
Twelve-Factor App
- Codebase: One codebase tracked in revision control
- Dependencies: Explicitly declare and isolate dependencies
- Config: Store config in the environment
- Backing Services: Treat backing services as attached resources
- Build, Release, Run: Strictly separate build and run stages
- Processes: Execute as one or more stateless processes
- Port Binding: Export services via port binding
- Concurrency: Scale out via the process model
- Disposability: Maximize robustness with fast startup and graceful shutdown
- Dev/Prod Parity: Keep development, staging, and production as similar as possible
- Logs: Treat logs as event streams
- Admin Processes: Run admin/management tasks as one-off processes
Requirements Engineering Methodologies
Agile Requirements Engineering
User Stories
Format: As a [role], I want [feature], so that [benefit]
Characteristics: - Independent: Can be developed separately - Negotiable: Details can be discussed and refined - Valuable: Provides value to users or business - Estimable: Can be sized for planning - Small: Can be completed in one iteration - Testable: Has clear acceptance criteria
Acceptance Criteria
- Define when a user story is complete
- Written in Given-When-Then format or EARS format
- Should be testable and specific
- Agreed upon by team and stakeholders
Behavior-Driven Development (BDD)
Gherkin Syntax
Feature: User Authentication
As a user
I want to log into the system
So that I can access my personal data
Scenario: Successful login
Given I am on the login page
When I enter valid credentials
Then I should be redirected to the dashboard
BDD Process
- Discovery: Explore and understand requirements
- Formulation: Document examples and scenarios
- Automation: Create executable specifications
Model-Based Requirements Engineering
Use Case Modeling
- Actors: External entities that interact with the system
- Use Cases: Specific interactions or functions
- Relationships: Include, extend, and generalization
Requirements Modeling Techniques
- Entity-Relationship Diagrams: Data relationships
- State Diagrams: System behavior over time
- Sequence Diagrams: Interaction between components
- Activity Diagrams: Workflow and process flow