- Mastering Microservices with Java
- Sourabh Sharma
- 292字
- 2021-07-02 13:03:39
Sample domain service
Let's create a sample domain service based on our table-reservation system. As discussed in this chapter, the importance of an efficient domain layer is the key to successful products or services. Projects developed based on the domain layer are more maintainable, highly cohesive, and decoupled. They provide high scalability in terms of business requirement changes, and have a low impact on the design of other layers.
Domain-driven development is based on the relevant domain, hence it is not recommended that you use a top-down approach where the UI would be developed first, followed by the rest of the layers, and finally the persistence layer. Nor should you use a bottom-up approach, where the persistence layer, such as the DB, is designed first, followed by the rest of the layers, with the UI last.
Having a domain model developed first, using the patterns described in this book, gives clarity to all team members functionality-wise, and an advantage to the software designer to build a flexible, maintainable, and consistent system that helps the organization to launch a world-class product with fewer maintenance costs.
Here, you will create a restaurant service that provides a feature to add and retrieve restaurants. Based on your implementation, you can add other functionalities, such as finding restaurants based on cuisine or ratings.
Start with the entity. Here, the restaurant is our entity, as each restaurant is unique and has an identifier. You can use an interface, or set of interfaces, to implement the entity in our table-reservation system. Ideally, if you follow the interface segregation principle, you will use a set of interfaces rather than a single interface.
According to Interface Segregation Principle ( ISP) clients should not depends upon interfaces that they don't use.
- C++ Primer習題集(第5版)
- Docker技術入門與實戰(第3版)
- Java高手真經(高級編程卷):Java Web高級開發技術
- SQL for Data Analytics
- Scratch 3游戲與人工智能編程完全自學教程
- 基于差分進化的優化方法及應用
- Podman實戰
- Building a Quadcopter with Arduino
- SQL Server與JSP動態網站開發
- The Professional ScrumMaster’s Handbook
- 從零開始:UI圖標設計與制作(第3版)
- 基于GPU加速的計算機視覺編程:使用OpenCV和CUDA實時處理復雜圖像數據
- Learning Cocos2d-JS Game Development
- 體驗之道:從需求到實踐的用戶體驗實戰
- Building Apple Watch Projects