Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Domain Driven Design
  ——GAP




                ITARI

                2009-09-15
A.         DDD

                         B.   DDD

                         C.   DDD




  GAP



Book Store   GAP   DDD
DDD(1)
 


 2004                Eric Evans
         Domain-Driven Design –Tackling Complexity in
 the Heart of Software  ...
DDD(2)
 
                 OOAD
 DDD
                              	

                        DDD




                	

DDD
      • 
      • 
      • 



       • 
       • 
       • 


      • 
      • 
      •     CRUD
      • 
DDD
  Design without DDD:

                                   “
 ” “            ”        Service
                        ...
DDD   (1)
DDD                   (2)

            /

      	




      	





                	

DDD   Ref POJO in action
DDD                               (1)
                      Object

       Entities Objects with a distinct identity
   ...
DDD   (2)
A.

                         B.


  GAP



Book Store   GAP   DDD
(Transaction Script)
 

      
      
          CRUD
      
                             Service
(   )
 
      

      
      
      
(Domain Model)

 
 

 

 
 
 
(   )
A.   GAP


  GAP                    B.   GAP DDD

                         C.

Book Store   GAP   DDD
GAP   (1)
GAP                      (2)
   View           GAP            B/S
      web                JSP JS
      AJAX

   Control...
GAP   (1)
GAP                                     (2)
                    GAP
      (Business Service)
                (DAO)


   ...
GAP

          Business Service
                       Business Service

          Domain Model VO Entity
              ...
GAP



Book Store   GAP   DDD
Book Store-GAP DDD
  Design with DDD:

                   “         (Domain Driven Design)
               ”
         	

...
Book Store-GAP DDD
  Package:
Book Store-GAP DDD
  Domain Model:
Book Store
       (Order)
                   gap.template.bookstore.model.Order


     init(Account account,List newIte...
Book Store
     (Order)
Book Store
          (Accoun)
                      gap.template.bookstore.model.Account


        payment(IBookStoreDa...
Book Store
     (Accoun)
Book Store
            (Cart)

       
                                             ItemVO(
                          ja...
Book Store-GAP DDD
     (Cart)
Book Store-GAP DDD




Service
-
TM

           IT


:                   68   A    (100094)
: 86-10-62431717
: 86-10-62431800
    : info@use.com.cn
Upcoming SlideShare
Loading in …5
×

领域驱动设计实例讲解

5,024 views

Published on

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

  • Be the first to comment

领域驱动设计实例讲解

  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

×