145 lines
2.7 KiB
Markdown
145 lines
2.7 KiB
Markdown
# [Pattern Name]
|
|
|
|
> **Category:** Technical Pattern
|
|
> **Last Updated:** [Date]
|
|
> **Status:** [Active/Deprecated/Proposed]
|
|
|
|
## Purpose
|
|
|
|
[Brief description of what this pattern accomplishes and why it exists]
|
|
|
|
## Context
|
|
|
|
**When to use this pattern:**
|
|
- [Scenario 1]
|
|
- [Scenario 2]
|
|
- [Scenario 3]
|
|
|
|
**When NOT to use this pattern:**
|
|
- [Anti-scenario 1]
|
|
- [Anti-scenario 2]
|
|
|
|
## Implementation
|
|
|
|
### Overview
|
|
|
|
[High-level description of how the pattern works]
|
|
|
|
### Structure
|
|
|
|
```
|
|
[Directory structure or component organization]
|
|
```
|
|
|
|
### Key Components
|
|
|
|
**[Component 1 Name]**
|
|
- Purpose: [What it does]
|
|
- Responsibilities: [What it handles]
|
|
- Location: [Where to find it]
|
|
|
|
**[Component 2 Name]**
|
|
- Purpose: [What it does]
|
|
- Responsibilities: [What it handles]
|
|
- Location: [Where to find it]
|
|
|
|
### Code Example
|
|
|
|
```[language]
|
|
// Example implementation showing the pattern in action
|
|
[Code snippet]
|
|
```
|
|
|
|
## Usage Examples
|
|
|
|
### Example 1: [Scenario Name]
|
|
|
|
**Situation:** [Describe the use case]
|
|
|
|
**Implementation:**
|
|
```[language]
|
|
[Code showing how pattern is applied]
|
|
```
|
|
|
|
**Result:** [What this achieves]
|
|
|
|
### Example 2: [Scenario Name]
|
|
|
|
**Situation:** [Describe the use case]
|
|
|
|
**Implementation:**
|
|
```[language]
|
|
[Code showing how pattern is applied]
|
|
```
|
|
|
|
**Result:** [What this achieves]
|
|
|
|
## Edge Cases and Gotchas
|
|
|
|
### Edge Case 1: [Case Name]
|
|
|
|
**Problem:** [What can go wrong]
|
|
**Solution:** [How to handle it]
|
|
|
|
### Edge Case 2: [Case Name]
|
|
|
|
**Problem:** [What can go wrong]
|
|
**Solution:** [How to handle it]
|
|
|
|
## Best Practices
|
|
|
|
1. **[Practice 1]:** [Description]
|
|
2. **[Practice 2]:** [Description]
|
|
3. **[Practice 3]:** [Description]
|
|
|
|
## Anti-Patterns
|
|
|
|
❌ **Don't:** [What to avoid]
|
|
**Why:** [Reason]
|
|
**Instead:** [Better approach]
|
|
|
|
❌ **Don't:** [What to avoid]
|
|
**Why:** [Reason]
|
|
**Instead:** [Better approach]
|
|
|
|
## Testing Strategy
|
|
|
|
**How to test code using this pattern:**
|
|
- [Testing approach 1]
|
|
- [Testing approach 2]
|
|
- [Testing approach 3]
|
|
|
|
**Example test:**
|
|
```[language]
|
|
[Test code example]
|
|
```
|
|
|
|
## Performance Considerations
|
|
|
|
- **[Aspect 1]:** [Performance implication]
|
|
- **[Aspect 2]:** [Performance implication]
|
|
- **[Aspect 3]:** [Performance implication]
|
|
|
|
## Related Patterns
|
|
|
|
- [Pattern Name](./pattern-file.md) - [Relationship description]
|
|
- [Pattern Name](./pattern-file.md) - [Relationship description]
|
|
|
|
## Related Documentation
|
|
|
|
- **Domain:** [Domain Doc](../domain/doc.md) - [Relevance]
|
|
- **Interfaces:** [Interface Doc](../interfaces/doc.md) - [Relevance]
|
|
- **Specifications:** [Spec](../specs/NNN-name/SDD.md) - [Relevance]
|
|
|
|
## References
|
|
|
|
- [External resource 1]
|
|
- [External resource 2]
|
|
- [Internal decision doc or RFC]
|
|
|
|
## Version History
|
|
|
|
| Date | Change | Author |
|
|
|------|--------|--------|
|
|
| [Date] | Initial documentation | [Name/Tool] |
|