SlideShare a Scribd company logo
1 of 65
Domain Driven Design &
Development with Spring Portfolio



            Srini Penchikala
       Ann Arbor Java User Group
           February 24, 2009
About the Speaker
• Enterprise Architect
• Writer: InfoQ, TSS, ONJava, DevX Java, java.net
• Speaker
• Detroit Java User Group Leader
• Using Java/JEE since 2000
• SOA/Web Services since 2006
• PowerPoint since September 2008


                                                    2
Presentation Goal




 “What” Domain Driven Design (DDD) is and “How”
 Spring Portfolio helps in implementing a DDD project



                                                        3
Format
    Interactive



    Demos



    Duration: ~45 minutes



    Q&A





                            4
Before we start…




• How many have heard of Domain Driven Design before?
• How many are currently using DDD?



                                                        5
Agenda
•   Domain Driven Design & Development
•   Spring Portfolio
•   Dependency Injection / AOP / Annotations
•   Spring Security (Demo)
•   Architecture Enforcement (Demo)
•   Code Generation (Demo)
•   Conclusions


                                               6
Agenda
•   Domain Driven Design & Development
•   Spring Portfolio
•   Dependency Injection / AOP / Annotations
•   Spring Security (Demo)
•   Architecture Enforcement (Demo)
•   Code Generation (Demo)
•   Conclusions


                                               7
Layered Architecture Diagram




                               8
Architecture Layers
    User Interface



    Application



    Domain



    Infrastructure





                      9
Domain Layer
    Represents concepts of business,


    information about business situation, and
    business rules.
    Maintains state reflecting the business


    situation.
    This layer is the heart of business


    software*.


                                                10
J2EE Architecture Model
                                      HTTP
   Application       Controller
                                      Session Management




                                      Transaction Management
                      Facade
                                      Caching




   Data Access   Data Access Object




   Persistence    Domain Object
                              *
                                                     Notes:
                                                     •     No real Domain Layer
                                                     •     Business Logic in Façade Layer  (Stateless
                                                           Session Beans  )
                                                     •     Direct Access to Data Access Objects
                                                           (CRUD logic is infrastructure not business
                                                                                                    )
                                                     •     *Domain objects are really Persistence
   Data Store                                              classes with getters
                                                                              /setters
                     Database                        •     Infrastructure concerns have overtaken/
                                                           overshadowed the domain concerns
                                                                                                        11
The Problem
    Architects/Developers are thinking only about



    infrastructure.
    Most of the development time is still spent on



    writing plumbing code instead of real business
    logic.
    We have lost real OOP





                                                    12
Domain Driven Architecture




                             13
Domain Driven Design &
Development




                         14
Domain Driven Design
What:
  Domain Driven Design (DDD) is about


  mapping business domain concepts into
  software artifacts.
Why:
  To create better software by focusing on a


  model of the domain rather than the
  technology.

                                               15
Domain Driven Design
    Is not a:



        new technology
    


        new framework
    


        JSR standard
    



    Is a:



        design pattern
    




                         16
Advantages
    Promotes high cohesion and low coupling


    in the application code
    Easy to test domain components



    Business (domain) logic is isolated from


    non-domain and infrastructure code
    Adding/changing services does not


    influence the domain or other services.


                                               17
Development Styles
    Transaction Script



    Table Module



    Domain Model





                         18
Development Styles
    A single instance that handles the
•

    business logic for all rows in a database
    table or view.




Choose the right style for the right application/service


Source: Patterns of Enterprise Application Architecture, Martin Fowler   19
DDD Manifesto
(Business) Domain             Infrastructure
    Domain State & Behavior       Persistence
                             



    Business Logic                Transaction Management
                             



    Business Rules                Remoting
                             



                                  Scheduling
                              




                                                           20
Domain Objects
    Domain objects are instances of real


    entities which hold any knowledge or
    activity of the business domain.




                                           21
Main Elements
    Entities



        Objects defined by their identity, which remains
    


        same throughout the life of software
    Value Objects



        Immutable objects that have no identity & are used
    


        to describe an attribute of another object.
    (Domain) Services



        Objects that have no state & only have a defined
    


        behavior that’s not part of any domain object.
                                                           22
Other Elements

    Module:



        A method of organizing related concepts and tasks
    


        in order to reduce complexity.
    Domain object Lifecycle is managed by:



        Aggregate
    


        Factory
    


        Repository
    




                                                        23
DDD Thought Process
    Start with domain entities and domain logic



        Basic domain-driven & object-oriented principles
    



    Mentally start without a quot;servicequot; layer



        See how far you can get
    


        Add service level as required
    



    You can refactor to DDD





Source: Domain Driven Design with AOP and DI, Presentation by
Ramnivas Laddad                                                 24
DDD Lifecycle Diagram




                        25
Agenda
•   Domain Driven Design & Development
•   Spring Portfolio
•   Dependency Injection / AOP / Annotations
•   Spring Security (Demo)
•   Architecture Enforcement (Demo)
•   Code Generation (Demo)
•   Conclusions


                                               26
Spring Framework
• Separation of concerns (business v.
  infrastructure)
• POJO Based Design
• Business domain first, infrastructure concerns
  second
• Agile Development and Testing



                                               27
Spring Philosophy




                    28
Spring Portfolio
    Spring Core



    Spring AOP



    Spring Security



    Spring MVC/Spring WebFlow





                                29
The Project
    Project Management



        Agile Methodology (SCRUM)
    


        Iterative Design, Development, Unit Testing and
    


        Refactoring.
    Architecture



        Focus on business domain & alignment with
    


        business model
        Isolation & Modularity
    


        Loosely coupled with other layers
    

                                                          30
        POJO programming model.
    
Agenda
•   Domain Driven Design & Development
•   Spring Portfolio
•   Dependency Injection / AOP / Annotations
•   Spring Security (Demo)
•   Architecture Enforcement (Demo)
•   Code Generation (Demo)
•   Conclusions


                                               31
Design Recipe
    Object Oriented Programming (OOP)



    Dependency Injection (DI)



    Aspect-oriented Programming (AOP)



    Annotations





                                        32
DDD with OOP Principles
   Domain Element           State/Behavior

Entity, Value Object,   State and Behavior
Aggregate
Data Transfer Object    State only

Service, Repository     Behavior only


                                             33
Dependency Injection
• Decouple and manage the dependencies of
  the components in the application
• DI Frameworks:
  • Spring
  • Google Guice
  • Pico Container



                                            34
DI Use Cases
    Service



        Domain Classes
    


        Transaction Manager
    


    Domain



        Data Access Object (DAO)
    


    DAO class



        Data Source
    


        JPA Entity Manager
    



                                   35
Domain Object DI
• @Configurable annotation




                             36
Aspect-oriented Programming
• Allows developers to add behavior to objects
  in a non-obtrusive manner through use of
  static and dynamic crosscutting.
• Main goal is to code cross-cutting concerns in
  separate modules and apply them in a
  declarative way.


                                               37
AOP Use Cases
    Framework Built-In Aspects


        Transaction Management
    


        Security
    




    Custom Aspects


        Profiling
    


        Caching
    


        Rules
    




                                 38
Annotations
• Added in Java SE 5.0 as Java Metadata
  facility (JSR 175).
• Provide a way to add metadata to program
  elements.
• Defined by nearly every recent JSR standard.
• Also include a mechanism for adding custom
  annotations to the Java code*.

                                             39
Annotations For Domain Elements
   Layer    Domain Element    Annotation
Domain
            Entity,          @Entity (JPA),
            Value Object     @Configurable
Domain      Repository       @Repository
Domain      Service          @Service
Application Controller       @Controller
All         All              @Component
                                           40
Custom Annotations Use Cases
• Caching
• Validation




                               41
Custom Annotations
• Implementation Options
  •   Reflection
  •   Annotation Processing Tool (APT)
  •   Byte-code Instrumentation (Javassist)
  •   Aspects/AOP (AspectJ and Spring AOP)




                                              42
Agenda
•   Domain Driven Design & Development
•   Spring Portfolio
•   Dependency Injection / AOP / Annotations
•   Spring Security (Demo)
•   Architecture Enforcement (Demo)
•   Code Generation (Demo)
•   Conclusions


                                               43
Domain Aspects
    Data Access



    Persistence



    Transaction Management



    Domain Security



    Business Operation Retry



    Caching





                               44
Persistence & Txn Management
    JDBC




    JPA w/ Hibernate, OpenJPA, EclipseLink



    (TopLink)
    Spring JPA Utils & Data Source DI




    Spring JTA Support



       –   Transactions are managed in Service classes
           using quot;@Transactionalquot; annotation

                                                     45
Spring Security
    Declarative Application Security support




    Fits in very well with Spring Framework



          Authentication
      


          Authorization
      


              URL level
          


              Domain Object
          


              Service Method
          




                                               46
DEMO




       47
Agenda
•   Domain Driven Design & Development
•   Spring Portfolio
•   Dependency Injection / AOP / Annotations
•   Spring Security (Demo)
•   Architecture Enforcement (Demo)
•   Code Generation (Demo)
•   Conclusions


                                               48
Architecture Enforcement
• Domain Driven Design Rules
• Enforcement using Aspects and AOP




                                      49
Rules – Compile Time
    Service classes should not depend on



    Application layer classes
    DAO classes should only be called from



    Domain classes




                                             50
DEMO




       51
Rules – Run Time
    Business operation retry




    Caching



        System Settings (using AOP)
    


        Application Variables/Business Data (using
    


        Annotations)




                                                     52
DEMO




       53
Agenda
•   Domain Driven Design & Development
•   Spring Portfolio
•   Dependency Injection / AOP / Annotations
•   Spring Security (Demo)
•   Architecture Enforcement (Demo)
•   Code Generation (Demo)
•   Conclusions


                                               54
Code Generation
Write:
     XSD
 


     Domain / Service
 


Code Generate:
     DAO interface and implementation
 


     Facade (EJB's & WebServices)
 


     DTO's
 


     Unit Tests (including test data)
 


     Spring configuration files
 

                                        55
Code Generation Tools
    openArchitectureWare (oAW)




    AndroMDA




    Aceleo Spring Module




    Skyway Builder





                                 56
DEMO




       57
Tools
    Spring for:



        Scheduling (Quartz)
    


        Configuration Management (Commons
    


        Configuration, JMX)
    Hibernate Tools (for DDL generation)




    Dozer (DO/DTO Assembly)





                                            58
DDD Lifecycle Diagram Revisited




                                  59
Agenda
•   Domain Driven Design & Development
•   Spring Portfolio
•   Dependency Injection / AOP / Annotations
•   Spring Security (Demo)
•   Architecture Enforcement (Demo)
•   Code Generation (Demo)
•   Conclusions


                                               60
Conclusions
• Domain First, Infrastructure Second
• Layered Architecture & Separation of Concerns
• Always keep the quot;contextquot; in mind
• Balance between the quot;rightquot; vs. the quot;right nowquot;
• Upcoming Java/JEE releases focus on development
  & deployment simplicity
• Spring 3.0, Java EE 6, JPA 2.0, EJB 3.1


                                                    61
References
• Domain Driven Design and Development In Practice
  (http://www.infoq.com/articles/ddd-in-practice)
• Domain-Driven Design Website
  (http://www.domaindrivendesign.org/)
• Domain-Driven Design by Eric Evans
• Applying Domain-Driven Design and Patterns, Jimmy
  Nilsson
• Patterns of Enterprise Application Architecture, Martin
  Fowler
• Can DDD be Adequately Implemented Without DI and
  AOP (http://www.infoq.com/news/2008/02/ddd-di-aop)
                                                            62
Contact Information
• Domain-Driven Design and Enterprise Architecture
  articles on InfoQ.
• InfoQ website (http://www.infoq.com)
• E-Mail: srinipenchikala@gmail.com
• Blog: http://srinip2007.blogspot.com




                                                     63
Q&A




      64
Thank You
• Thank you for your attention
• Feedback survey




                                 65

More Related Content

What's hot

Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignNaeem Sarfraz
 
Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationOğuzhan Soykan
 
ドメイン駆動設計 実践ガイド
ドメイン駆動設計 実践ガイドドメイン駆動設計 実践ガイド
ドメイン駆動設計 実践ガイド増田 亨
 
「実践ドメイン駆動設計」 から理解するDDD (2018年11月)
「実践ドメイン駆動設計」 から理解するDDD (2018年11月)「実践ドメイン駆動設計」 から理解するDDD (2018年11月)
「実践ドメイン駆動設計」 から理解するDDD (2018年11月)A AOKI
 
リッチなドメインモデル 名前探し
リッチなドメインモデル 名前探しリッチなドメインモデル 名前探し
リッチなドメインモデル 名前探し増田 亨
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introductionwojtek_s
 
ドメインロジックの実装方法とドメイン駆動設計
ドメインロジックの実装方法とドメイン駆動設計ドメインロジックの実装方法とドメイン駆動設計
ドメインロジックの実装方法とドメイン駆動設計Tadayoshi Sato
 
ドメイン駆動設計 基本を理解する
ドメイン駆動設計 基本を理解するドメイン駆動設計 基本を理解する
ドメイン駆動設計 基本を理解する増田 亨
 
ドメイン駆動設計の正しい歩き方
ドメイン駆動設計の正しい歩き方ドメイン駆動設計の正しい歩き方
ドメイン駆動設計の正しい歩き方増田 亨
 
ドメイン駆動設計という仕事の流儀
ドメイン駆動設計という仕事の流儀ドメイン駆動設計という仕事の流儀
ドメイン駆動設計という仕事の流儀増田 亨
 
ドメイン駆動設計(DDD)の実践Part2
ドメイン駆動設計(DDD)の実践Part2ドメイン駆動設計(DDD)の実践Part2
ドメイン駆動設計(DDD)の実践Part2増田 亨
 
ドメイン駆動設計 モデリング_実装入門勉強会_2020.3.8
ドメイン駆動設計 モデリング_実装入門勉強会_2020.3.8ドメイン駆動設計 モデリング_実装入門勉強会_2020.3.8
ドメイン駆動設計 モデリング_実装入門勉強会_2020.3.8Koichiro Matsuoka
 
Domain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledNicola Costantino
 
ドメイン駆動設計 ( DDD ) をやってみよう
ドメイン駆動設計 ( DDD ) をやってみようドメイン駆動設計 ( DDD ) をやってみよう
ドメイン駆動設計 ( DDD ) をやってみよう増田 亨
 
ドメイン駆動設計 の 実践 Part3 DDD
ドメイン駆動設計 の 実践 Part3 DDDドメイン駆動設計 の 実践 Part3 DDD
ドメイン駆動設計 の 実践 Part3 DDD増田 亨
 
「関心の分離」と「疎結合」 ソフトウェアアーキテクチャのひとかけら
「関心の分離」と「疎結合」   ソフトウェアアーキテクチャのひとかけら「関心の分離」と「疎結合」   ソフトウェアアーキテクチャのひとかけら
「関心の分離」と「疎結合」 ソフトウェアアーキテクチャのひとかけらAtsushi Nakamura
 
Domain driven design and model driven development
Domain driven design and model driven developmentDomain driven design and model driven development
Domain driven design and model driven developmentDmitry Geyzersky
 

What's hot (20)

Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven Design
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design(DDD) Presentation
Domain Driven Design(DDD) PresentationDomain Driven Design(DDD) Presentation
Domain Driven Design(DDD) Presentation
 
ドメイン駆動設計 実践ガイド
ドメイン駆動設計 実践ガイドドメイン駆動設計 実践ガイド
ドメイン駆動設計 実践ガイド
 
「実践ドメイン駆動設計」 から理解するDDD (2018年11月)
「実践ドメイン駆動設計」 から理解するDDD (2018年11月)「実践ドメイン駆動設計」 から理解するDDD (2018年11月)
「実践ドメイン駆動設計」 から理解するDDD (2018年11月)
 
リッチなドメインモデル 名前探し
リッチなドメインモデル 名前探しリッチなドメインモデル 名前探し
リッチなドメインモデル 名前探し
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
ドメインロジックの実装方法とドメイン駆動設計
ドメインロジックの実装方法とドメイン駆動設計ドメインロジックの実装方法とドメイン駆動設計
ドメインロジックの実装方法とドメイン駆動設計
 
ドメイン駆動設計 基本を理解する
ドメイン駆動設計 基本を理解するドメイン駆動設計 基本を理解する
ドメイン駆動設計 基本を理解する
 
ドメイン駆動設計の正しい歩き方
ドメイン駆動設計の正しい歩き方ドメイン駆動設計の正しい歩き方
ドメイン駆動設計の正しい歩き方
 
ドメイン駆動設計という仕事の流儀
ドメイン駆動設計という仕事の流儀ドメイン駆動設計という仕事の流儀
ドメイン駆動設計という仕事の流儀
 
ドメイン駆動設計(DDD)の実践Part2
ドメイン駆動設計(DDD)の実践Part2ドメイン駆動設計(DDD)の実践Part2
ドメイン駆動設計(DDD)の実践Part2
 
ドメイン駆動設計 モデリング_実装入門勉強会_2020.3.8
ドメイン駆動設計 モデリング_実装入門勉強会_2020.3.8ドメイン駆動設計 モデリング_実装入門勉強会_2020.3.8
ドメイン駆動設計 モデリング_実装入門勉強会_2020.3.8
 
Domain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) DistilledDomain Driven Design (Ultra) Distilled
Domain Driven Design (Ultra) Distilled
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
ドメイン駆動設計 ( DDD ) をやってみよう
ドメイン駆動設計 ( DDD ) をやってみようドメイン駆動設計 ( DDD ) をやってみよう
ドメイン駆動設計 ( DDD ) をやってみよう
 
Domain Driven Design
Domain Driven Design Domain Driven Design
Domain Driven Design
 
ドメイン駆動設計 の 実践 Part3 DDD
ドメイン駆動設計 の 実践 Part3 DDDドメイン駆動設計 の 実践 Part3 DDD
ドメイン駆動設計 の 実践 Part3 DDD
 
「関心の分離」と「疎結合」 ソフトウェアアーキテクチャのひとかけら
「関心の分離」と「疎結合」   ソフトウェアアーキテクチャのひとかけら「関心の分離」と「疎結合」   ソフトウェアアーキテクチャのひとかけら
「関心の分離」と「疎結合」 ソフトウェアアーキテクチャのひとかけら
 
Domain driven design and model driven development
Domain driven design and model driven developmentDomain driven design and model driven development
Domain driven design and model driven development
 

Viewers also liked

Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Alan Christensen
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignYoung-Ho Cho
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven DesignDavid Berliner
 
Domain Driven Design using Laravel
Domain Driven Design using LaravelDomain Driven Design using Laravel
Domain Driven Design using Laravelwajrcs
 
Common Mechanical Engineering Terms
Common Mechanical Engineering TermsCommon Mechanical Engineering Terms
Common Mechanical Engineering TermsBinh Vo
 
Hipster JS: Angular & Firebase (Tri-JS Meetup)
Hipster JS: Angular & Firebase (Tri-JS Meetup)Hipster JS: Angular & Firebase (Tri-JS Meetup)
Hipster JS: Angular & Firebase (Tri-JS Meetup)Lee Trout
 
Domain Driven Design - DDDSydney 2011
Domain Driven Design - DDDSydney 2011Domain Driven Design - DDDSydney 2011
Domain Driven Design - DDDSydney 2011thinkddd
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatiasapientindia
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignÜrgo Ringo
 
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
Applying Domain-Driven Design to APIs and Microservices  - Austin API MeetupApplying Domain-Driven Design to APIs and Microservices  - Austin API Meetup
Applying Domain-Driven Design to APIs and Microservices - Austin API MeetupLaunchAny
 
Singleton Object Management
Singleton Object ManagementSingleton Object Management
Singleton Object Managementppd1961
 
Erlang factory layered architecture - final
Erlang factory   layered architecture - finalErlang factory   layered architecture - final
Erlang factory layered architecture - finalDennis Docter
 
Domain Driven Design with the F# type System -- NDC London 2013
Domain Driven Design with the F# type System -- NDC London 2013Domain Driven Design with the F# type System -- NDC London 2013
Domain Driven Design with the F# type System -- NDC London 2013Scott Wlaschin
 

Viewers also liked (20)

Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Agile Yaklaşımlar
Agile YaklaşımlarAgile Yaklaşımlar
Agile Yaklaşımlar
 
Domain driven design
Domain driven designDomain driven design
Domain driven design
 
Refactoring for Domain Driven Design
Refactoring for Domain Driven DesignRefactoring for Domain Driven Design
Refactoring for Domain Driven Design
 
Event storming recipes
Event storming recipesEvent storming recipes
Event storming recipes
 
Domain Driven Design using Laravel
Domain Driven Design using LaravelDomain Driven Design using Laravel
Domain Driven Design using Laravel
 
Common Mechanical Engineering Terms
Common Mechanical Engineering TermsCommon Mechanical Engineering Terms
Common Mechanical Engineering Terms
 
Homeschooling 5 años
Homeschooling 5 añosHomeschooling 5 años
Homeschooling 5 años
 
Hipster JS: Angular & Firebase (Tri-JS Meetup)
Hipster JS: Angular & Firebase (Tri-JS Meetup)Hipster JS: Angular & Firebase (Tri-JS Meetup)
Hipster JS: Angular & Firebase (Tri-JS Meetup)
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Domain Driven Design - DDDSydney 2011
Domain Driven Design - DDDSydney 2011Domain Driven Design - DDDSydney 2011
Domain Driven Design - DDDSydney 2011
 
Rp 6 session 2 naresh bhatia
Rp 6  session 2 naresh bhatiaRp 6  session 2 naresh bhatia
Rp 6 session 2 naresh bhatia
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
Applying Domain-Driven Design to APIs and Microservices  - Austin API MeetupApplying Domain-Driven Design to APIs and Microservices  - Austin API Meetup
Applying Domain-Driven Design to APIs and Microservices - Austin API Meetup
 
Singleton Object Management
Singleton Object ManagementSingleton Object Management
Singleton Object Management
 
Erlang factory layered architecture - final
Erlang factory   layered architecture - finalErlang factory   layered architecture - final
Erlang factory layered architecture - final
 
Domain Driven Design with the F# type System -- NDC London 2013
Domain Driven Design with the F# type System -- NDC London 2013Domain Driven Design with the F# type System -- NDC London 2013
Domain Driven Design with the F# type System -- NDC London 2013
 
Unit 3 machines
Unit 3 machines Unit 3 machines
Unit 3 machines
 

Similar to Domain Driven Design Development Spring Portfolio

Aras ALM Workshop for PLM Configuration Management
Aras ALM Workshop for PLM Configuration ManagementAras ALM Workshop for PLM Configuration Management
Aras ALM Workshop for PLM Configuration ManagementAras
 
[DSBW Spring 2009] Unit 03: WebEng Process Models
[DSBW Spring 2009] Unit 03: WebEng Process Models[DSBW Spring 2009] Unit 03: WebEng Process Models
[DSBW Spring 2009] Unit 03: WebEng Process ModelsCarles Farré
 
From Requirements Management to Release with Git for Android System
From Requirements Management to Release with Git for Android System From Requirements Management to Release with Git for Android System
From Requirements Management to Release with Git for Android System Intland Software GmbH
 
Zen and Enterprise Architecture
Zen and Enterprise ArchitectureZen and Enterprise Architecture
Zen and Enterprise ArchitectureRichard Green
 
Are good SharePoint solutions only a myth?
Are good SharePoint solutions only a myth?Are good SharePoint solutions only a myth?
Are good SharePoint solutions only a myth?Adis Jugo
 
Novidades natural e adabas
Novidades natural e adabasNovidades natural e adabas
Novidades natural e adabasSoftware AG
 
Segundo Semario de SharePoint en Mexico por Joel Oleson
Segundo Semario de SharePoint en Mexico por Joel OlesonSegundo Semario de SharePoint en Mexico por Joel Oleson
Segundo Semario de SharePoint en Mexico por Joel OlesonJoel Oleson
 
Model Driven Architecture (MDA): Motivations, Status & Future
Model Driven Architecture (MDA): Motivations, Status & FutureModel Driven Architecture (MDA): Motivations, Status & Future
Model Driven Architecture (MDA): Motivations, Status & Futureelliando dias
 
Best Practices Europe 10 Steps To Successful Deployments
Best Practices Europe 10 Steps To Successful DeploymentsBest Practices Europe 10 Steps To Successful Deployments
Best Practices Europe 10 Steps To Successful DeploymentsJoel Oleson
 
Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009Srini Penchikala
 
Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009guest2b8cd
 
Felipe Rodrigues Ddd The Way Back To Oo
Felipe Rodrigues Ddd The Way Back To OoFelipe Rodrigues Ddd The Way Back To Oo
Felipe Rodrigues Ddd The Way Back To Oodeimos
 
App301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent LibApp301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent Libmcgurk
 
Aras Innovator PLM Deployment Methodology
Aras Innovator PLM Deployment MethodologyAras Innovator PLM Deployment Methodology
Aras Innovator PLM Deployment MethodologyAras
 
Refactoring Ruby on Rails Applications
Refactoring Ruby on Rails ApplicationsRefactoring Ruby on Rails Applications
Refactoring Ruby on Rails ApplicationsJonathan Weiss
 
Jee design patterns- Marek Strejczek - Rule Financial
Jee design patterns- Marek Strejczek - Rule FinancialJee design patterns- Marek Strejczek - Rule Financial
Jee design patterns- Marek Strejczek - Rule FinancialRule_Financial
 
Standard Issue: Preparing for the Future of Data Management
Standard Issue: Preparing for the Future of Data ManagementStandard Issue: Preparing for the Future of Data Management
Standard Issue: Preparing for the Future of Data ManagementInside Analysis
 

Similar to Domain Driven Design Development Spring Portfolio (20)

Aras ALM Workshop for PLM Configuration Management
Aras ALM Workshop for PLM Configuration ManagementAras ALM Workshop for PLM Configuration Management
Aras ALM Workshop for PLM Configuration Management
 
[DSBW Spring 2009] Unit 03: WebEng Process Models
[DSBW Spring 2009] Unit 03: WebEng Process Models[DSBW Spring 2009] Unit 03: WebEng Process Models
[DSBW Spring 2009] Unit 03: WebEng Process Models
 
From Requirements Management to Release with Git for Android System
From Requirements Management to Release with Git for Android System From Requirements Management to Release with Git for Android System
From Requirements Management to Release with Git for Android System
 
Zen and Enterprise Architecture
Zen and Enterprise ArchitectureZen and Enterprise Architecture
Zen and Enterprise Architecture
 
Are good SharePoint solutions only a myth?
Are good SharePoint solutions only a myth?Are good SharePoint solutions only a myth?
Are good SharePoint solutions only a myth?
 
Novidades natural e adabas
Novidades natural e adabasNovidades natural e adabas
Novidades natural e adabas
 
Segundo Semario de SharePoint en Mexico por Joel Oleson
Segundo Semario de SharePoint en Mexico por Joel OlesonSegundo Semario de SharePoint en Mexico por Joel Oleson
Segundo Semario de SharePoint en Mexico por Joel Oleson
 
Model Driven Architecture (MDA): Motivations, Status & Future
Model Driven Architecture (MDA): Motivations, Status & FutureModel Driven Architecture (MDA): Motivations, Status & Future
Model Driven Architecture (MDA): Motivations, Status & Future
 
Bynet2.3 Adobe Flex builder 4
Bynet2.3 Adobe Flex builder 4Bynet2.3 Adobe Flex builder 4
Bynet2.3 Adobe Flex builder 4
 
Best Practices Europe 10 Steps To Successful Deployments
Best Practices Europe 10 Steps To Successful DeploymentsBest Practices Europe 10 Steps To Successful Deployments
Best Practices Europe 10 Steps To Successful Deployments
 
Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009
 
Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009Architecture Enforcement Aspects Itarc2009
Architecture Enforcement Aspects Itarc2009
 
Felipe Rodrigues Ddd The Way Back To Oo
Felipe Rodrigues Ddd The Way Back To OoFelipe Rodrigues Ddd The Way Back To Oo
Felipe Rodrigues Ddd The Way Back To Oo
 
App301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent LibApp301 Implement a Data Access Layer with Ent Lib
App301 Implement a Data Access Layer with Ent Lib
 
Aras Innovator PLM Deployment Methodology
Aras Innovator PLM Deployment MethodologyAras Innovator PLM Deployment Methodology
Aras Innovator PLM Deployment Methodology
 
Methodology
MethodologyMethodology
Methodology
 
Refactoring Ruby on Rails Applications
Refactoring Ruby on Rails ApplicationsRefactoring Ruby on Rails Applications
Refactoring Ruby on Rails Applications
 
Jee design patterns- Marek Strejczek - Rule Financial
Jee design patterns- Marek Strejczek - Rule FinancialJee design patterns- Marek Strejczek - Rule Financial
Jee design patterns- Marek Strejczek - Rule Financial
 
2009-dec-10 Architectuur en HL7
2009-dec-10 Architectuur en HL72009-dec-10 Architectuur en HL7
2009-dec-10 Architectuur en HL7
 
Standard Issue: Preparing for the Future of Data Management
Standard Issue: Preparing for the Future of Data ManagementStandard Issue: Preparing for the Future of Data Management
Standard Issue: Preparing for the Future of Data Management
 

Recently uploaded

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 

Domain Driven Design Development Spring Portfolio

  • 1. Domain Driven Design & Development with Spring Portfolio Srini Penchikala Ann Arbor Java User Group February 24, 2009
  • 2. About the Speaker • Enterprise Architect • Writer: InfoQ, TSS, ONJava, DevX Java, java.net • Speaker • Detroit Java User Group Leader • Using Java/JEE since 2000 • SOA/Web Services since 2006 • PowerPoint since September 2008 2
  • 3. Presentation Goal “What” Domain Driven Design (DDD) is and “How” Spring Portfolio helps in implementing a DDD project 3
  • 4. Format Interactive  Demos  Duration: ~45 minutes  Q&A  4
  • 5. Before we start… • How many have heard of Domain Driven Design before? • How many are currently using DDD? 5
  • 6. Agenda • Domain Driven Design & Development • Spring Portfolio • Dependency Injection / AOP / Annotations • Spring Security (Demo) • Architecture Enforcement (Demo) • Code Generation (Demo) • Conclusions 6
  • 7. Agenda • Domain Driven Design & Development • Spring Portfolio • Dependency Injection / AOP / Annotations • Spring Security (Demo) • Architecture Enforcement (Demo) • Code Generation (Demo) • Conclusions 7
  • 9. Architecture Layers User Interface  Application  Domain  Infrastructure  9
  • 10. Domain Layer Represents concepts of business,  information about business situation, and business rules. Maintains state reflecting the business  situation. This layer is the heart of business  software*. 10
  • 11. J2EE Architecture Model HTTP Application Controller Session Management Transaction Management Facade Caching Data Access Data Access Object Persistence Domain Object * Notes: • No real Domain Layer • Business Logic in Façade Layer (Stateless Session Beans ) • Direct Access to Data Access Objects (CRUD logic is infrastructure not business ) • *Domain objects are really Persistence Data Store classes with getters /setters Database • Infrastructure concerns have overtaken/ overshadowed the domain concerns 11
  • 12. The Problem Architects/Developers are thinking only about  infrastructure. Most of the development time is still spent on  writing plumbing code instead of real business logic. We have lost real OOP  12
  • 14. Domain Driven Design & Development 14
  • 15. Domain Driven Design What: Domain Driven Design (DDD) is about  mapping business domain concepts into software artifacts. Why: To create better software by focusing on a  model of the domain rather than the technology. 15
  • 16. Domain Driven Design Is not a:  new technology  new framework  JSR standard  Is a:  design pattern  16
  • 17. Advantages Promotes high cohesion and low coupling  in the application code Easy to test domain components  Business (domain) logic is isolated from  non-domain and infrastructure code Adding/changing services does not  influence the domain or other services. 17
  • 18. Development Styles Transaction Script  Table Module  Domain Model  18
  • 19. Development Styles A single instance that handles the • business logic for all rows in a database table or view. Choose the right style for the right application/service Source: Patterns of Enterprise Application Architecture, Martin Fowler 19
  • 20. DDD Manifesto (Business) Domain Infrastructure Domain State & Behavior Persistence   Business Logic Transaction Management   Business Rules Remoting   Scheduling  20
  • 21. Domain Objects Domain objects are instances of real  entities which hold any knowledge or activity of the business domain. 21
  • 22. Main Elements Entities  Objects defined by their identity, which remains  same throughout the life of software Value Objects  Immutable objects that have no identity & are used  to describe an attribute of another object. (Domain) Services  Objects that have no state & only have a defined  behavior that’s not part of any domain object. 22
  • 23. Other Elements Module:  A method of organizing related concepts and tasks  in order to reduce complexity. Domain object Lifecycle is managed by:  Aggregate  Factory  Repository  23
  • 24. DDD Thought Process Start with domain entities and domain logic  Basic domain-driven & object-oriented principles  Mentally start without a quot;servicequot; layer  See how far you can get  Add service level as required  You can refactor to DDD  Source: Domain Driven Design with AOP and DI, Presentation by Ramnivas Laddad 24
  • 26. Agenda • Domain Driven Design & Development • Spring Portfolio • Dependency Injection / AOP / Annotations • Spring Security (Demo) • Architecture Enforcement (Demo) • Code Generation (Demo) • Conclusions 26
  • 27. Spring Framework • Separation of concerns (business v. infrastructure) • POJO Based Design • Business domain first, infrastructure concerns second • Agile Development and Testing 27
  • 29. Spring Portfolio Spring Core  Spring AOP  Spring Security  Spring MVC/Spring WebFlow  29
  • 30. The Project Project Management  Agile Methodology (SCRUM)  Iterative Design, Development, Unit Testing and  Refactoring. Architecture  Focus on business domain & alignment with  business model Isolation & Modularity  Loosely coupled with other layers  30 POJO programming model. 
  • 31. Agenda • Domain Driven Design & Development • Spring Portfolio • Dependency Injection / AOP / Annotations • Spring Security (Demo) • Architecture Enforcement (Demo) • Code Generation (Demo) • Conclusions 31
  • 32. Design Recipe Object Oriented Programming (OOP)  Dependency Injection (DI)  Aspect-oriented Programming (AOP)  Annotations  32
  • 33. DDD with OOP Principles Domain Element State/Behavior Entity, Value Object, State and Behavior Aggregate Data Transfer Object State only Service, Repository Behavior only 33
  • 34. Dependency Injection • Decouple and manage the dependencies of the components in the application • DI Frameworks: • Spring • Google Guice • Pico Container 34
  • 35. DI Use Cases Service  Domain Classes  Transaction Manager  Domain  Data Access Object (DAO)  DAO class  Data Source  JPA Entity Manager  35
  • 36. Domain Object DI • @Configurable annotation 36
  • 37. Aspect-oriented Programming • Allows developers to add behavior to objects in a non-obtrusive manner through use of static and dynamic crosscutting. • Main goal is to code cross-cutting concerns in separate modules and apply them in a declarative way. 37
  • 38. AOP Use Cases Framework Built-In Aspects  Transaction Management  Security  Custom Aspects  Profiling  Caching  Rules  38
  • 39. Annotations • Added in Java SE 5.0 as Java Metadata facility (JSR 175). • Provide a way to add metadata to program elements. • Defined by nearly every recent JSR standard. • Also include a mechanism for adding custom annotations to the Java code*. 39
  • 40. Annotations For Domain Elements Layer Domain Element Annotation Domain Entity, @Entity (JPA), Value Object @Configurable Domain Repository @Repository Domain Service @Service Application Controller @Controller All All @Component 40
  • 41. Custom Annotations Use Cases • Caching • Validation 41
  • 42. Custom Annotations • Implementation Options • Reflection • Annotation Processing Tool (APT) • Byte-code Instrumentation (Javassist) • Aspects/AOP (AspectJ and Spring AOP) 42
  • 43. Agenda • Domain Driven Design & Development • Spring Portfolio • Dependency Injection / AOP / Annotations • Spring Security (Demo) • Architecture Enforcement (Demo) • Code Generation (Demo) • Conclusions 43
  • 44. Domain Aspects Data Access  Persistence  Transaction Management  Domain Security  Business Operation Retry  Caching  44
  • 45. Persistence & Txn Management JDBC  JPA w/ Hibernate, OpenJPA, EclipseLink  (TopLink) Spring JPA Utils & Data Source DI  Spring JTA Support  – Transactions are managed in Service classes using quot;@Transactionalquot; annotation 45
  • 46. Spring Security Declarative Application Security support  Fits in very well with Spring Framework  Authentication  Authorization  URL level  Domain Object  Service Method  46
  • 47. DEMO 47
  • 48. Agenda • Domain Driven Design & Development • Spring Portfolio • Dependency Injection / AOP / Annotations • Spring Security (Demo) • Architecture Enforcement (Demo) • Code Generation (Demo) • Conclusions 48
  • 49. Architecture Enforcement • Domain Driven Design Rules • Enforcement using Aspects and AOP 49
  • 50. Rules – Compile Time Service classes should not depend on  Application layer classes DAO classes should only be called from  Domain classes 50
  • 51. DEMO 51
  • 52. Rules – Run Time Business operation retry  Caching  System Settings (using AOP)  Application Variables/Business Data (using  Annotations) 52
  • 53. DEMO 53
  • 54. Agenda • Domain Driven Design & Development • Spring Portfolio • Dependency Injection / AOP / Annotations • Spring Security (Demo) • Architecture Enforcement (Demo) • Code Generation (Demo) • Conclusions 54
  • 55. Code Generation Write: XSD  Domain / Service  Code Generate: DAO interface and implementation  Facade (EJB's & WebServices)  DTO's  Unit Tests (including test data)  Spring configuration files  55
  • 56. Code Generation Tools openArchitectureWare (oAW)  AndroMDA  Aceleo Spring Module  Skyway Builder  56
  • 57. DEMO 57
  • 58. Tools Spring for:  Scheduling (Quartz)  Configuration Management (Commons  Configuration, JMX) Hibernate Tools (for DDL generation)  Dozer (DO/DTO Assembly)  58
  • 59. DDD Lifecycle Diagram Revisited 59
  • 60. Agenda • Domain Driven Design & Development • Spring Portfolio • Dependency Injection / AOP / Annotations • Spring Security (Demo) • Architecture Enforcement (Demo) • Code Generation (Demo) • Conclusions 60
  • 61. Conclusions • Domain First, Infrastructure Second • Layered Architecture & Separation of Concerns • Always keep the quot;contextquot; in mind • Balance between the quot;rightquot; vs. the quot;right nowquot; • Upcoming Java/JEE releases focus on development & deployment simplicity • Spring 3.0, Java EE 6, JPA 2.0, EJB 3.1 61
  • 62. References • Domain Driven Design and Development In Practice (http://www.infoq.com/articles/ddd-in-practice) • Domain-Driven Design Website (http://www.domaindrivendesign.org/) • Domain-Driven Design by Eric Evans • Applying Domain-Driven Design and Patterns, Jimmy Nilsson • Patterns of Enterprise Application Architecture, Martin Fowler • Can DDD be Adequately Implemented Without DI and AOP (http://www.infoq.com/news/2008/02/ddd-di-aop) 62
  • 63. Contact Information • Domain-Driven Design and Enterprise Architecture articles on InfoQ. • InfoQ website (http://www.infoq.com) • E-Mail: srinipenchikala@gmail.com • Blog: http://srinip2007.blogspot.com 63
  • 64. Q&A 64
  • 65. Thank You • Thank you for your attention • Feedback survey 65