Trade-off Patterns
Common architectural trade-offs and strategies for resolving them.
Quality Attribute Trade-offs
Section titled “Quality Attribute Trade-offs”Performance vs. Maintainability
Section titled “Performance vs. Maintainability”Trade-off: Optimized code is often harder to understand and maintain.
Example Scenarios:
- Loop unrolling vs. readable loops
- Caching complexity vs. data freshness
- Denormalized data vs. normalized schema
Resolution Strategies:
- Measure first: Only optimize proven bottlenecks
- Isolate complexity: Keep optimizations in separate modules
- Document thoroughly: Explain why non-obvious code exists
- Benchmark continuously: Ensure optimizations remain necessary
ADR Consequence Format:
* Good, because response time reduced from 500ms to 50ms* Bad, because cache invalidation logic adds complexity* Neutral, because team agrees optimization is justified by SLA requirementsSecurity vs. Usability
Section titled “Security vs. Usability”Trade-off: More security measures often increase friction for users.
Example Scenarios:
- Multi-factor authentication vs. quick login
- Strict password policies vs. user convenience
- Session timeouts vs. user experience
Resolution Strategies:
- Risk-based approach: Apply strongest security where risk is highest
- Progressive security: Increase requirements for sensitive operations
- Modern methods: Use passwordless auth, biometrics
- User research: Find security/UX balance through testing
ADR Consequence Format:
* Good, because unauthorized access risk reduced significantly* Bad, because users must complete additional verification step* Neutral, because security requirements are non-negotiable for financial dataScalability vs. Cost
Section titled “Scalability vs. Cost”Trade-off: Systems designed for high scale often cost more.
Example Scenarios:
- Kubernetes vs. single server
- Distributed database vs. single instance
- CDN vs. origin-only serving
Resolution Strategies:
- Design for growth: Architecture supports scaling without rewrite
- Scale when needed: Start simple, add capacity as required
- Right-size: Match infrastructure to actual demand
- Cost monitoring: Track cost per transaction/user
ADR Consequence Format:
* Good, because system can handle 100x current load* Bad, because infrastructure cost increases by 3x* Neutral, because growth projections justify investmentFlexibility vs. Simplicity
Section titled “Flexibility vs. Simplicity”Trade-off: Configurable systems are more complex.
Example Scenarios:
- Plugin architecture vs. monolithic
- Feature flags vs. code branches
- Generic solutions vs. specific implementations
Resolution Strategies:
- YAGNI principle: Don’t add flexibility until needed
- Extension points: Design for extension, not modification
- Configuration limits: Only expose commonly needed options
- Default behaviors: Provide sensible defaults
ADR Consequence Format:
* Good, because new integrations can be added without code changes* Bad, because plugin system adds architectural complexity* Neutral, because expected integration volume justifies flexibilityConsistency vs. Availability (CAP Theorem)
Section titled “Consistency vs. Availability (CAP Theorem)”Trade-off: Distributed systems must choose between consistency and availability during partitions.
Example Scenarios:
- Strong vs. eventual consistency
- Synchronous vs. asynchronous replication
- Single leader vs. multi-leader
Resolution Strategies:
- Understand requirements: Not all data needs strong consistency
- Hybrid approach: Different consistency for different data
- Compensating actions: Design for eventual consistency with rollback
- User expectations: Set appropriate expectations in UI
ADR Consequence Format:
* Good, because system remains available during network partitions* Bad, because users may see stale data for up to 5 seconds* Neutral, because use case tolerates eventual consistencyTechnology Trade-offs
Section titled “Technology Trade-offs”Build vs. Buy
Section titled “Build vs. Buy”Trade-off: Building provides control, buying provides speed.
| Factor | Build | Buy |
|---|---|---|
| Time to market | Slower | Faster |
| Control | Full | Limited |
| Cost (short-term) | Higher | Lower |
| Cost (long-term) | Variable | Predictable |
| Maintenance | Internal | Vendor |
| Customization | Unlimited | Constrained |
Decision Framework:
- Is this a core competency?
- Do off-the-shelf solutions meet requirements?
- What is the total cost of ownership?
- What are the switching costs?
Monolith vs. Microservices
Section titled “Monolith vs. Microservices”Trade-off: Monoliths are simpler; microservices scale independently.
| Factor | Monolith | Microservices |
|---|---|---|
| Complexity | Lower | Higher |
| Deployment | Simpler | More complex |
| Scaling | All-or-nothing | Granular |
| Team autonomy | Shared codebase | Independent |
| Data consistency | Easier | Harder |
| Debugging | Simpler | Distributed tracing needed |
Decision Framework:
- Team size and structure
- Scale requirements
- Rate of change by component
- Operational maturity
SQL vs. NoSQL
Section titled “SQL vs. NoSQL”Trade-off: SQL provides consistency; NoSQL provides flexibility.
| Factor | SQL | NoSQL |
|---|---|---|
| Schema | Fixed | Flexible |
| ACID | Native | Variable |
| Scaling | Vertical | Horizontal |
| Query language | Standardized | Vendor-specific |
| Joins | Efficient | Limited/none |
| Use case | Transactions | Unstructured data |
Decision Framework:
- Data structure complexity
- Query patterns
- Consistency requirements
- Scale requirements
Resolution Patterns
Section titled “Resolution Patterns”Pattern 1: Prioritized Requirements
Section titled “Pattern 1: Prioritized Requirements”When to use: Multiple valid options, need objective selection.
Process:
- List all decision drivers
- Assign weights (1-5) based on importance
- Score each option against drivers
- Calculate weighted score
- Choose highest-scoring option
Template:
| Driver | Weight | Option A | Option B | Option C ||--------|--------|----------|----------|----------|| Performance | 5 | 4 (20) | 3 (15) | 5 (25) || Cost | 3 | 3 (9) | 5 (15) | 2 (6) || Maintainability | 4 | 5 (20) | 3 (12) | 3 (12) || **Total** | | **49** | **42** | **43** |Pattern 2: Time-Based Trade-off
Section titled “Pattern 2: Time-Based Trade-off”When to use: Short-term and long-term needs differ.
Process:
- Identify immediate needs
- Project long-term requirements
- Choose option that balances both
- Document migration path if needed
Template:
### Short-term (0-6 months)- Need: Quick deployment- Solution: Simple single-server setup
### Long-term (6-24 months)- Need: Handle 10x growth- Solution: Migrate to Kubernetes
### Migration Path1. Phase 1: Containerize application2. Phase 2: Deploy to managed K8s3. Phase 3: Add horizontal scalingPattern 3: Risk-Based Decision
Section titled “Pattern 3: Risk-Based Decision”When to use: Options have different risk profiles.
Process:
- Identify risks for each option
- Assess likelihood and impact
- Consider risk tolerance
- Choose option with acceptable risk
Template:
| Option | Risk | Likelihood | Impact | Score ||--------|------|------------|--------|-------|| A | Vendor lock-in | High | Medium | 6 || A | Data migration | Low | High | 4 || B | Performance issues | Medium | High | 6 || B | Learning curve | High | Low | 3 |Pattern 4: Reversibility Analysis
Section titled “Pattern 4: Reversibility Analysis”When to use: Uncertain about long-term needs.
Process:
- Assess how reversible each option is
- Prefer reversible choices when uncertain
- Document switching costs
- Plan for potential changes
Categories:
- Type 1 (Irreversible): Major commitment, hard to undo
- Type 2 (Reversible): Can change direction with reasonable effort
Guidance: Make Type 1 decisions carefully; make Type 2 decisions quickly.
Trade-off Documentation
Section titled “Trade-off Documentation”Explicit Trade-off Section
Section titled “Explicit Trade-off Section”## Trade-offs Accepted
This decision accepts the following trade-offs:
### Performance vs. SimplicityWe accept slightly lower performance (estimated 10% slower) in exchange for:- Simpler codebase- Easier onboarding- Faster development
### Cost vs. ReliabilityWe accept higher infrastructure cost ($2K/month) in exchange for:- 99.9% uptime SLA- Automatic failover- Managed backups
### Flexibility vs. SpeedWe accept vendor lock-in in exchange for:- Faster time to market- Reduced operational burden- Access to managed servicesTrade-off Matrix
Section titled “Trade-off Matrix”## Trade-off Analysis
| Trade-off | Option A | Option B | Our Choice ||-----------|----------|----------|------------|| Perf vs. Maint | +Perf | +Maint | B (Maint) || Cost vs. Scale | +Cost | +Scale | A (Cost) || Simple vs. Flex | +Simple | +Flex | A (Simple) |Best Practices
Section titled “Best Practices”Document Explicitly
Section titled “Document Explicitly”Always document:
- What trade-off was made
- Why this balance was chosen
- What was given up
- When to revisit the decision
Involve Stakeholders
Section titled “Involve Stakeholders”Different stakeholders have different priorities:
- Product: User experience, time to market
- Engineering: Maintainability, technical debt
- Operations: Reliability, observability
- Finance: Cost, ROI
Review Periodically
Section titled “Review Periodically”Trade-offs should be revisited when:
- Requirements change significantly
- Technology landscape shifts
- Scale increases beyond projections
- Pain points emerge in operations