Skip to content

Commit 4deea40

Browse files
fixing-changes
1 parent e52be91 commit 4deea40

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

posts/facade-design-pattern.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ class PostsController
150150

151151
**Encapsulation:** The facade hides the logic of how the `ApiRepositoryInterface` is resolved, providing a layer of abstraction.
152152

153+
Facade design pattern When:
154+
155+
- You hide complex internals (multiple services under one method); filterData, sortdata, cachedata, paginateData ...
156+
- You simplify API for external usage (clean, consistent calls), so external code doesn't deal with low-level setup, configs, or multiple classes — - just one clean call.
157+
- You encapsulate subsystems without changing original classes.
158+
- You want static-like access to bound services (Laravel style), expl; `QueryFilters::applyFilters()`
159+
153160
### Conclusion:
154161

155162
- **Subsystem:** `ApiRepository` and `ApiRepositoryInterface` does the actual work (structuring and generating API responses).

0 commit comments

Comments
 (0)