SlideShare une entreprise Scribd logo
1  sur  35
Télécharger pour lire hors ligne
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)”         	

DDD(2)
 
                 OOAD
 DDD
                              	

                        DDD




                	

DDD
      • 
      • 
      • 



       • 
       • 
       • 


      • 
      • 
      •     CRUD
      • 
DDD
  Design without DDD:

                                   “
 ” “            ”        Service
                         getter setter


Service                     	





                                       	

DDD   (1)
DDD                   (2)

            /

      	




      	





                	

DDD   Ref POJO in action
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
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
                                        Action

   Domain


   Persistence                           O/R
    Mapping JDBC

                                  IOC
GAP   (1)
GAP                                     (2)
                    GAP
      (Business Service)
                (DAO)


                                         (OrderModel)
                                    VO Entity
           Entity          Entity
                                                   DAO


  

  



                GAP                            VO
GAP

          Business Service
                       Business Service

          Domain Model VO Entity
                         UML

 

 
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 newItems)
                             Items
     submit(IBookStoreDao dao,List newItems)

     cancle(IBookStoreDao dao)                          item
                  “      ”          dao
     dispose(IBookStoreDao dao)                     service
                    Acount           payment
                                          dispose
Book Store
     (Order)
Book Store
          (Accoun)
                      gap.template.bookstore.model.Account


        payment(IBookStoreDao dao,BigDecimal price)

                                                 (
           )

                     dao
        augmentMoney(BigDecimal moeny)

                                       service
        setDiscount isAdmin
Book Store
     (Accoun)
Book Store
            (Cart)

       
                                             ItemVO(
                          javabean) List
        addItem(ItemVO item)
        removeItem(ItemVO item)
        removeItemByBookId(String bookId)
         item book        bookId      item             bookId
               item
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

Contenu connexe

Similaire à 领域驱动设计实例讲解

Nagios Conference 2012 - Dave Josephsen - 2002 called they want there rrd she...
Nagios Conference 2012 - Dave Josephsen - 2002 called they want there rrd she...Nagios Conference 2012 - Dave Josephsen - 2002 called they want there rrd she...
Nagios Conference 2012 - Dave Josephsen - 2002 called they want there rrd she...Nagios
 
How Klout is changing the landscape of social media with Hadoop and BI
How Klout is changing the landscape of social media with Hadoop and BIHow Klout is changing the landscape of social media with Hadoop and BI
How Klout is changing the landscape of social media with Hadoop and BIDenny Lee
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repositorynobby
 
dojo.data, stores and widgets
dojo.data, stores and widgetsdojo.data, stores and widgets
dojo.data, stores and widgetsklipstein
 
Klout changing landscape of social media
Klout changing landscape of social mediaKlout changing landscape of social media
Klout changing landscape of social mediaDataWorks Summit
 
Four Problems You Run into When DIY-ing a “Big Data” Analytics System
Four Problems You Run into When DIY-ing a “Big Data” Analytics SystemFour Problems You Run into When DIY-ing a “Big Data” Analytics System
Four Problems You Run into When DIY-ing a “Big Data” Analytics SystemTreasure Data, Inc.
 
Sharded By Business Line: Migrating to a Core Database using MongoDB and Solr
Sharded By Business Line: Migrating to a Core Database using MongoDB and SolrSharded By Business Line: Migrating to a Core Database using MongoDB and Solr
Sharded By Business Line: Migrating to a Core Database using MongoDB and SolrMongoDB
 
Mongo la search platform - january 2013
Mongo la   search platform - january 2013Mongo la   search platform - january 2013
Mongo la search platform - january 2013MongoDB
 
Above the cloud: Big Data and BI
Above the cloud: Big Data and BIAbove the cloud: Big Data and BI
Above the cloud: Big Data and BIDenny Lee
 
Flash Camp Chennai - Social network with ORM
Flash Camp Chennai - Social network with ORMFlash Camp Chennai - Social network with ORM
Flash Camp Chennai - Social network with ORMRIA RUI Society
 
How dojo works
How dojo worksHow dojo works
How dojo worksAmit Tyagi
 
KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB
KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB
KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB Rakuten Group, Inc.
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBTobias Trelle
 
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB
 
DynamoDB Gluecon 2012
DynamoDB Gluecon 2012DynamoDB Gluecon 2012
DynamoDB Gluecon 2012Appirio
 
Gluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBGluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBJeff Douglas
 
Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDB
Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDBBattle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDB
Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDBJesse Wolgamott
 
Scaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter ExperienceScaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter ExperienceDataWorks Summit
 

Similaire à 领域驱动设计实例讲解 (20)

Nagios Conference 2012 - Dave Josephsen - 2002 called they want there rrd she...
Nagios Conference 2012 - Dave Josephsen - 2002 called they want there rrd she...Nagios Conference 2012 - Dave Josephsen - 2002 called they want there rrd she...
Nagios Conference 2012 - Dave Josephsen - 2002 called they want there rrd she...
 
How Klout is changing the landscape of social media with Hadoop and BI
How Klout is changing the landscape of social media with Hadoop and BIHow Klout is changing the landscape of social media with Hadoop and BI
How Klout is changing the landscape of social media with Hadoop and BI
 
The Java Content Repository
The Java Content RepositoryThe Java Content Repository
The Java Content Repository
 
dojo.data, stores and widgets
dojo.data, stores and widgetsdojo.data, stores and widgets
dojo.data, stores and widgets
 
Klout changing landscape of social media
Klout changing landscape of social mediaKlout changing landscape of social media
Klout changing landscape of social media
 
Galaxy of bits
Galaxy of bitsGalaxy of bits
Galaxy of bits
 
Four Problems You Run into When DIY-ing a “Big Data” Analytics System
Four Problems You Run into When DIY-ing a “Big Data” Analytics SystemFour Problems You Run into When DIY-ing a “Big Data” Analytics System
Four Problems You Run into When DIY-ing a “Big Data” Analytics System
 
Sharded By Business Line: Migrating to a Core Database using MongoDB and Solr
Sharded By Business Line: Migrating to a Core Database using MongoDB and SolrSharded By Business Line: Migrating to a Core Database using MongoDB and Solr
Sharded By Business Line: Migrating to a Core Database using MongoDB and Solr
 
Mongo la search platform - january 2013
Mongo la   search platform - january 2013Mongo la   search platform - january 2013
Mongo la search platform - january 2013
 
Above the cloud: Big Data and BI
Above the cloud: Big Data and BIAbove the cloud: Big Data and BI
Above the cloud: Big Data and BI
 
MongoDB
MongoDBMongoDB
MongoDB
 
Flash Camp Chennai - Social network with ORM
Flash Camp Chennai - Social network with ORMFlash Camp Chennai - Social network with ORM
Flash Camp Chennai - Social network with ORM
 
How dojo works
How dojo worksHow dojo works
How dojo works
 
KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB
KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB
KVSの性能、RDBMSのインデックス、更にMapReduceを併せ持つAll-in-One NoSQL: MongoDB
 
Java Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDBJava Persistence Frameworks for MongoDB
Java Persistence Frameworks for MongoDB
 
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
DynamoDB Gluecon 2012
DynamoDB Gluecon 2012DynamoDB Gluecon 2012
DynamoDB Gluecon 2012
 
Gluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDBGluecon 2012 - DynamoDB
Gluecon 2012 - DynamoDB
 
Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDB
Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDBBattle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDB
Battle of NoSQL stars: Amazon's SDB vs MongoDB vs CouchDB vs RavenDB
 
Scaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter ExperienceScaling Big Data Mining Infrastructure Twitter Experience
Scaling Big Data Mining Infrastructure Twitter Experience
 

领域驱动设计实例讲解

  • 1. Domain Driven Design ——GAP ITARI 2009-09-15
  • 2. A. DDD B. DDD C. DDD GAP Book Store GAP DDD
  • 3. DDD(1)   2004 Eric Evans Domain-Driven Design –Tackling Complexity in the Heart of Software — “ ( DDD)” 
  • 4. DDD(2)   OOAD DDD  DDD 
  • 5. DDD •  •  •  •  •  •  •  •  •  CRUD • 
  • 6. DDD   Design without DDD: “ ” “ ” Service getter setter Service  
  • 7. DDD (1)
  • 8. DDD (2) /   
  • 9. DDD Ref POJO in action
  • 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. DDD (2)
  • 12. A. B. GAP Book Store GAP DDD
  • 13. (Transaction Script)       CRUD   Service
  • 14. ( )          
  • 16. ( )
  • 17. A. GAP GAP B. GAP DDD C. Book Store GAP DDD
  • 18. GAP (1)
  • 19. GAP (2)   View GAP B/S web JSP JS AJAX   Control Action   Domain   Persistence O/R Mapping JDBC IOC
  • 20. GAP (1)
  • 21. GAP (2)   GAP (Business Service) (DAO)   (OrderModel) VO Entity Entity Entity   DAO     GAP VO
  • 22. GAP   Business Service Business Service   Domain Model VO Entity UML    
  • 23. GAP Book Store GAP DDD
  • 24. Book Store-GAP DDD   Design with DDD: “ (Domain Driven Design) ”  
  • 26. Book Store-GAP DDD   Domain Model:
  • 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. Book Store   (Order)
  • 29. Book Store   (Accoun)   gap.template.bookstore.model.Account   payment(IBookStoreDao dao,BigDecimal price) ( ) dao   augmentMoney(BigDecimal moeny) service   setDiscount isAdmin
  • 30. Book Store   (Accoun)
  • 31. Book Store   (Cart)   ItemVO( javabean) List   addItem(ItemVO item)   removeItem(ItemVO item)   removeItemByBookId(String bookId) item book bookId item bookId item
  • 34. -
  • 35. TM IT : 68 A (100094) : 86-10-62431717 : 86-10-62431800 : info@use.com.cn