41 lines
1.4 KiB
Markdown
41 lines
1.4 KiB
Markdown
# Builders (Deprecated)
|
|
|
|
**This document is deprecated.** See [`BUILDERS.md`](docs/architecture/website/BUILDERS.md) for the current pattern.
|
|
|
|
## Summary of changes
|
|
|
|
The architecture has been updated to use **Builders** instead of **Presenters**:
|
|
|
|
### Old pattern (deprecated)
|
|
- `lib/presenters/` - All transformations
|
|
- `lib/view-models/` - ViewModels + some presenters
|
|
|
|
### New pattern (current)
|
|
- `lib/builders/view-models/` - DTO → ViewModel
|
|
- `lib/builders/view-data/` - ViewModel → ViewData
|
|
- `lib/view-models/` - ViewModels only
|
|
|
|
### Why the change?
|
|
|
|
The old pattern had **three anti-patterns**:
|
|
|
|
1. **Inconsistent naming** - Same concept had 3 names (Presenter, Transformer, ViewModelPresenter)
|
|
2. **Inconsistent location** - Presenters lived in both `lib/presenters/` and `lib/view-models/`
|
|
3. **Confusing semantics** - "Presenter" implies presenting to client, but some presenters prepared data for server templates
|
|
|
|
### What changed?
|
|
|
|
**ViewModel Builders** (DTO → ViewModel):
|
|
- Location: `lib/builders/view-models/`
|
|
- Naming: `*ViewModelBuilder`
|
|
- Example: `AdminViewModelBuilder.build(dto)`
|
|
|
|
**ViewData Builders** (ViewModel → ViewData):
|
|
- Location: `lib/builders/view-data/`
|
|
- Naming: `*ViewDataBuilder`
|
|
- Example: `LeagueViewDataBuilder.build(viewModel, id)`
|
|
|
|
This makes the architecture **self-documenting** and **clean**.
|
|
|
|
See [`BUILDERS.md`](docs/architecture/website/BUILDERS.md) for full details.
|