Presentation is loading. Please wait.

Presentation is loading. Please wait.

Domain-Driven Design: Large-Scale Structure*

Similar presentations


Presentation on theme: "Domain-Driven Design: Large-Scale Structure*"— Presentation transcript:

1 Domain-Driven Design: Large-Scale Structure*
To-ju Huang Computer Science Department University of California, San Diego April 23, 2010 *Evans 2003 Domain-Driven Design: Tacking Complexity in the Heart of Software (Ch. 16). Addison-Wesley Longman Publishing Co., Inc.

2 Outline Motivating Example – Online Bookstore Background
Domain-Driven Design Role of Large-Scale Structure Large-Scale Structure Responsibility Layer Knowledge Level Pluggable Component Framework Conclusion Outline

3 Motivating Example - Online Bookstore
Requirements Customers can place orders online Customers can pay orders online (credit cards or PayPal) Customers can access order, shipping, payment information Warehouse staff can prepare and ship orders Warehouse staff can contact distributors to restock Assumptions (some will change later) Single warehouse and single seller (i.e. the owner company itself) No physical store (only online-purchase) Motivating Example - Online Bookstore

4 Motivating Example - Online Bookstore
customer 1 * order book catalog * orderline book 1 1 1 * * 1 shipment payment PayPal transaction stock distributor 1..* 1 courier credit card transaction warehouse Motivating Example - Online Bookstore

5 Motivating Example - Online Bookstore
Modeling Challenges We may miss the big picture when the model grows big Relations among entities can change on the fly; we need flexibility while obeying high-level domain restrictions The same high-level abstraction recurs among projects which do not work closely together; the similarity ends right here and prevents further reuse Motivating Example - Online Bookstore

6 Outline Motivating Example – Online Bookstore Background
Domain-Driven Design Role of Large-Scale Structure Large-Scale Structure Responsibility Layer Knowledge Level Pluggable Component Framework Conclusion Outline

7 Domain-Driven Design What Domain-Driven Design is about?
Shared models serve both design and implementation teams Communication via unified domain languages, whose vocabulary is used to through the models Efficient communication helps stakeholders gain and accumulate insights, which in turn enter the unification domain language; this forms a positive feedback loop Relation to Model-Driven Engineering initiatives (e.g. MDA) Both are domain engineering approaches Both advocate the central role of models in software development DDD focuses more on modeling practices; MDE initiatives are more about the development processes Domain-Driven Design

8 Role of Large-Scale Structure
Help stakeholders to grasp the high-level of the model; everybody can identify and locate his responsibility easily Efficient communication is assured: different teams can understand their roles and relations to the others Prevents teams from diverging to the point that the whole project breaks into remotely related pieces Role of Large-Scale Structure

9 Outline Motivating Example – Online Bookstore Background
Domain-Driven Design Role of Large-Scale Structure Large-Scale Structure Responsibility Layer Knowledge Level Pluggable Component Framework Conclusion Outline

10 could this be on layers lower?
Layers help us track dependencies more easily, but we need more guidance on making layers why 3 layers? could this be on layers lower? why in the same layer? Responsibility Layer

11 credit card transaction
Some meaningful partitions may manifest themselves, by the responsibilities assumed by a group of entities operation customer 1 * order book catalog * orderline book 1 1 * * 1 shipment payment PayPal transaction stock distributor 1..* 1 courier credit card transaction warehouse Responsibility Layer capability AND, beware of the dependencies among layers

12 credit card transaction
Lower layers should not know upper layers operation customer 1 * order book catalog * orderline book 1 product 1 * * 1 shipment payment PayPal transaction stock distributor 1..* 1 courier credit card transaction warehouse Responsibility Layer capability

13 We can have more layers according to responsibilities
sales report, business analysis discount/promotion enabler decision discount policy promotion policy policy order orderline book shipment payment book catalog stock distributor credit card transaction PayPal transaction courier customer warehouse * 1 1..* product operation pricing Responsibility Layer capability

14 Outline Motivating Example – Online Bookstore Background
Domain-Driven Design Role of Large-Scale Structure Large-Scale Structure Responsibility Layer Knowledge Level Pluggable Component Framework Conclusion Outline

15 Knowledge Level Now, the online bookstore allows 3rd-party booksellers
1 product book 1 product manufacturing info stock distributor stock distributor 1..* 1..* self-supplied stock regular stock warehouse warehouse Knowledge Level individual warehouse owned warehouse

16 However, the company decided that some individual sellers could be bought in, so owned warehouse can be associated both kind of stock … TOO RESTRICTED manufacturing info stock distributor 1..* self-supplied stock regular stock warehouse Knowledge Level individual warehouse owned warehouse

17 However, the company decided that some individual sellers could be bought in, so owned warehouse can be associated both kind of stock … manufacturing info stock distributor manufacturing info distributor 1..* 1..* self-supplied stock regular stock warehouse stock warehouse individual warehouse regular stock individual warehouse Knowledge Level owned warehouse owned warehouse self-supplied stock

18 Knowledge Level TOO LOOSE
But, this is a weird that individual seller can have regular stock or owned-warehouse have manufacturing info TOO LOOSE 1..* manufacturing info distributor warehouse stock individual warehouse regular stock Knowledge Level owned warehouse self-supplied stock

19 But, this is a weird that individual seller can have regular stock
manufacturing info distributor 1..* warehouse stock individual warehouse regular stock Knowledge Level owned warehouse self-supplied stock

20 We introduce the warehouse type which indirectly associate stock, distributor, manufacturing info to warehouse while can only be modified by certain entities manufacturing info distributor 1..* regular stock manufacturing info self-supplied stock warehouse stock individual warehouse regular stock distributor stock Knowledge Level owned warehouse self-supplied stock warehouse type 1 warehouse

21 We introduce the warehouse type which indirectly associate stock, distributor, manufacturing info to warehouse while can only be modified by certain entities regular stock Knowledge Level manufacturing info self-supplied stock distributor stock warehouse type 1 warehouse Operation Level

22 Outline Motivating Example – Online Bookstore Background
Domain-Driven Design Role of Large-Scale Structure Large-Scale Structure Responsibility Layer Knowledge Level Pluggable Component Framework Conclusion Outline

23 Pluggable Component Framework
Entities can be substituted by compatible plugins However, agreed-upon standards are required… customer 1 * order <<interface >> catalog * orderline <<interface >> product 1 1 * * 1 shipment <<interface >> payment PayPal transaction stock <<interface >> distributor 1..* 1 <<interface >> courier Pluggable Component Framework credit card transaction <<interface >> warehouse

24 Large-scale structure helps stakeholders to understand their roles, improve communication, and keep project coherent Dependencies can be turned into responsibility layers with clear meanings Knowledge level allows flexible relations among entities while keeping the model consistent with the business logic Pluggable component framework, if feasible standards employed, can make high-level architecture fully utilized Conclusion

25 Thank You


Download ppt "Domain-Driven Design: Large-Scale Structure*"

Similar presentations


Ads by Google