领域驱动设计实例讲解

4,681 views
4,510 views

Published on

主要介绍了领域驱动设计的基本思想,比较事务脚本和领域模型,同时介绍了领域模型的开发实例。

0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,681
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
153
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide

领域驱动设计实例讲解

  1. 1. Domain Driven Design ——GAP ITARI 2009-09-15
  2. 2. A. DDD B. DDD C. DDD GAP Book Store GAP DDD
  3. 3. DDD(1)   2004 Eric Evans Domain-Driven Design –Tackling Complexity in the Heart of Software — “ ( DDD)” 
  4. 4. DDD(2)   OOAD DDD  DDD 
  5. 5. DDD •  •  •  •  •  •  •  •  •  CRUD • 
  6. 6. DDD   Design without DDD: “ ” “ ” Service getter setter Service  
  7. 7. DDD (1)
  8. 8. DDD (2) /   
  9. 9. DDD Ref POJO in action
  10. 10. DDD (1)   Object   Entities Objects with a distinct identity ID   Value objects Objects with no distinct identity   Factories Define methods for creating entities   Repositories Manage collections of entities and encapsulate the persistence framework DAO   Services Implement responsibilities that can’t be assigned to a single class and encapsulate the domain model
  11. 11. DDD (2)
  12. 12. A. B. GAP Book Store GAP DDD
  13. 13. (Transaction Script)       CRUD   Service
  14. 14. ( )          
  15. 15. (Domain Model)            
  16. 16. ( )
  17. 17. A. GAP GAP B. GAP DDD C. Book Store GAP DDD
  18. 18. GAP (1)
  19. 19. GAP (2)   View GAP B/S web JSP JS AJAX   Control Action   Domain   Persistence O/R Mapping JDBC IOC
  20. 20. GAP (1)
  21. 21. GAP (2)   GAP (Business Service) (DAO)   (OrderModel) VO Entity Entity Entity   DAO     GAP VO
  22. 22. GAP   Business Service Business Service   Domain Model VO Entity UML    
  23. 23. GAP Book Store GAP DDD
  24. 24. Book Store-GAP DDD   Design with DDD: “ (Domain Driven Design) ”  
  25. 25. Book Store-GAP DDD   Package:
  26. 26. Book Store-GAP DDD   Domain Model:
  27. 27. Book Store   (Order)   gap.template.bookstore.model.Order   init(Account account,List newItems) Items   submit(IBookStoreDao dao,List newItems)   cancle(IBookStoreDao dao) item “ ” dao   dispose(IBookStoreDao dao) service Acount payment dispose
  28. 28. Book Store   (Order)
  29. 29. Book Store   (Accoun)   gap.template.bookstore.model.Account   payment(IBookStoreDao dao,BigDecimal price) ( ) dao   augmentMoney(BigDecimal moeny) service   setDiscount isAdmin
  30. 30. Book Store   (Accoun)
  31. 31. Book Store   (Cart)   ItemVO( javabean) List   addItem(ItemVO item)   removeItem(ItemVO item)   removeItemByBookId(String bookId) item book bookId item bookId item
  32. 32. Book Store-GAP DDD   (Cart)
  33. 33. Book Store-GAP DDD Service
  34. 34. -
  35. 35. TM IT : 68 A (100094) : 86-10-62431717 : 86-10-62431800 : info@use.com.cn

×