官术网_书友最值得收藏!

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.
主站蜘蛛池模板: 沐川县| 常熟市| 普安县| 临邑县| 潼关县| 平顺县| 赣榆县| 蒙城县| 乌兰察布市| 广南县| 米泉市| 乌恰县| 德江县| 安泽县| 西宁市| 枣强县| 香格里拉县| 阳原县| 饶平县| 鄱阳县| 南靖县| 建湖县| 桃园市| 平南县| 沅陵县| 二手房| 曲沃县| 安平县| 湾仔区| 河曲县| 鹤壁市| 南昌县| 乐陵市| 新源县| 沁水县| 北川| 太康县| 古交市| 永顺县| 嘉兴市| 巴彦淖尔市|