# Best Practices And Anti-Patterns

> Best Practices And Anti-Patterns in the Mobile Action Pro course.

- URL: https://dantech.academy/en/courses/kotlin-accelerator/engineer-builder/06-clean-architecture/lesson-12-best-practices
- Course: [Mobile Action Pro](https://dantech.academy/en/courses/kotlin-accelerator.md)
- Module: Clean Architecture in Depth
- Duration: 25 min
- Difficulty: intermediate
- Access: Enrolled students
- Tiếng Việt: https://dantech.academy/courses/kotlin-accelerator/engineer-builder/06-clean-architecture/lesson-12-best-practices.md

## Objectives

- Verify that :domain is pure with the build file and git grep
- Use empty(), require and classifying errors once at the boundary
- Recognize when not to add a layer, and weigh trade-offs like error messages in the domain

## In this lesson

1. Lesson Goal
2. Part 1: A Truly Pure Domain, And Provably So
3. Part 2: Non-Null Models With empty()
4. Part 3: Invariants With require()
5. Part 4: Classify Errors Once, At The Boundary
6. Part 5: An Explicit Composition Root
7. Part 6: Don't Add Layers You Don't Need
8. Practice Exercise
9. Code Reading Path
10. Signs To Avoid
11. References
12. Key Points

## Study with an AI agent

The full lesson is for students of this course. Students open the lesson on the web and press **Markdown** to copy all of it, then paste it into Claude, ChatGPT, Cursor or whichever agent you use. Faster: mint a token at `/profile/ai-agents` and your agent reads lessons over MCP.

- [Join the course](https://dantech.academy/en/kotlin-accelerator/checkout)

---

- Previous lesson: [Mapping Between Layers](https://dantech.academy/en/courses/kotlin-accelerator/engineer-builder/06-clean-architecture/lesson-11-mapping-layers.md)
- Next lesson: [DI And Inversion Of Control](https://dantech.academy/en/courses/kotlin-accelerator/engineer-builder/07-dependency-injection/lesson-01-di-basics.md)
