MODEL DRIVEN DEVELOPMENT
With smart use cases, domain driven design and Tobago MDA
SANDER HOOGENDOORN

Capgemini
      Principal technology officer
      Chief architect Accelerated Delivery Platform (ADP)
      Global agile thought leader
Other
      Author books and articles
      Speaker at international conferences
      Microsoft Partner Advisory Council .NET
      Capping IT Off Blog
      Magazine columns
      Editorial boards & Advisory boards
Web
      www.sanderhoogendoorn.com
      www.smartusecase.com
      Twitter: @aahoogendoorn
      LinkedIn: aahoogendoorn



                                                                INTRODUCTION TO AGILE              2
                                                            ©2011 Capgemini. All Rights Reserved
AGENDA

Today’s topics
    Smart use cases
    Domain driven design
    Software architecture
    Model driven development
    with Tobago MDA
    Generating code
    with Tobago MDA
    Demo(s)!




                                   INTRODUCTION TO AGILE              3
                               ©2011 Capgemini. All Rights Reserved
SMART USE CASES
A YAGNI approach to requirements
AGILE REQUIREMENTS - APPROACH
          Cloud Level               Kite Level      Sea Level                       Fish Level




                                       B

                                            D


                        A
                                  Hierarchical                                                         E
  A                                                    D                                    D
                                   Processes
                        B   C                                                                          F

                                                    Use Cases                      Smart
Project            Hierarchical                 C
                                                                                  Use Cases
Scope               Processes
                                           D

                                  Chronological
                                   Processes


                                                                    INTRODUCTION TO AGILE                  5
                                                                ©2011 Capgemini. All Rights Reserved
CLOUD LEVEL




                  INTRODUCTION TO AGILE              6
              ©2011 Capgemini. All Rights Reserved
KITE LEVEL




                 INTRODUCTION TO AGILE              7
             ©2011 Capgemini. All Rights Reserved
MODELING SMART USE CASES – SEA AND FISH LEVEL




                                                INTRODUCTION TO AGILE              8
                                            ©2011 Capgemini. All Rights Reserved
SMART USE CASES
Stereotypes
DOMAIN DRIVEN DEVELOPMENT
A brief introduction
DOMAIN DRIVEN DEVELOPMENT - VOCABULARY

 Entity
      Object in the domain model not defined by its attributes,
      but by a thread of continuity and identity
 Value object
      Has no conceptual identity.
      Describe a characteristic of a thing
 Repository
      Methods for retrieving domain objects should delegate to a
      specialized 'repository' object such that alternative
      implementations may be easily interchanged.
 Factory
      Methods for creating domain objects should delegate to a
      specialized 'factory' object such that alternative
      implementations may be easily interchanged.
 Service
      Implement if an operation does not conceptually belong to
      any entity
      Implement these operations in services




                                                                       INTRODUCTION TO AGILE              11
                                                                   ©2011 Capgemini. All Rights Reserved
DOMAIN DRIVEN DEVELOPMENT – EXTENDED VOCABULARY

 Enumeration *
     Restricted and limited set of possible values
     Apply only when set of values never changes

 Smart reference *
     Generic reference entity
     Restricted but unlimited list of possible
     values
     Apply when only reference matters, not
     additional values, like in reports or drop
     downs




                                                         INTRODUCTION TO AGILE              12
                                                     ©2011 Capgemini. All Rights Reserved
ENTITY ATTRIBUTES
ENTITY ATTRIBUTES – TYPES OF ATTRIBUTES

 Basic types
     string, integer, DateTime
     Including nullable wrapping
 Enumerations
     Genders, Categories
 Value objects
     No specific instances
     Isbn, Postcode, Bsn
 Simple references
     Smart references, such as Language, County
 Associations
     Other entities such as Customer, Product
     Within or outside aggregate



                                                      INTRODUCTION TO AGILE              14
                                                  ©2011 Capgemini. All Rights Reserved
VALUE OBJECT – IN USE




                            INTRODUCTION TO AGILE              15
                        ©2011 Capgemini. All Rights Reserved
SMART REFERENCE - TABLE




                              INTRODUCTION TO AGILE              16
                          ©2011 Capgemini. All Rights Reserved
SMART REFERENCE – IN USE




                               INTRODUCTION TO AGILE              17
                           ©2011 Capgemini. All Rights Reserved
SOFTWARE ARCHITECTURE
A true requirements for model driven development
Pages
Presentation                                        UserControls
                                                         Panels



                                                           Use cases
Process                                                    Workflow



                                 Domain objects / Entities
Domain                            Factories / Repositories
                  Enums / Value objects / Smart references
                                                [Mapping]


                                              Table Gateways
Data / Services                                       Queries
                                                     [Mapping]




Outside world                                               Database



                                          INTRODUCTION TO AGILE              19
                                      ©2011 Capgemini. All Rights Reserved
MODEL DRIVEN DEVELOPMENT
With Tobago MDA
User interface            Software Architecture
                                       specification
                     1. Map your                                                 5. Finalize your
                 business processes                                                application
  Existing       to smart use cases
Applications               Smart
                          use cases
                                                                Forms

                                                                               Use cases
                                                           4. Generate
                                                         your code using
                                                Tobago
                                                 MDA     a text template                                           Frameworks
Specifications                                                engine
                                                                                 Domain
                             Domain
                             Model                                               objects




                                                                         Data / Service
  Business
                                                                            classes
  models


                      2. Set up your         Test
                                                                                             3. Establish
                                          scenario’s
                      domain model                                                         your software
                                                                   Databases
                                                                                           architecture(s)

                                                                                       INTRODUCTION TO AGILE              21
                                                                                   ©2011 Capgemini. All Rights Reserved
MODEL DRIVEN DEVELOPMENT – TEMPLATE ENGINES

 Characteristics
     Load UML model (expressed in XMI)
     Load templates (from flat files)
     Combine elements from UML model with
     templates to generate deliverables
 Templates
     Templates contains code that runs in template
     engine
     Templates might use a folder model
 Generation process
     Ability to generate all or individual UML model
     elements
     Which UML model elements are supported?
     Generated deliverables can be code but also
     any other document type



                                                           INTRODUCTION TO AGILE              22
                                                       ©2011 Capgemini. All Rights Reserved
MODEL DRIVEN DEVELOPMENT - TEMPLATE ENGINES


                   Properties can
                     be used in
                     templates
Template engine
 knows (part of)
 the UML meta
     model




                                               INTRODUCTION TO AGILE              23
                                           ©2011 Capgemini. All Rights Reserved
MODEL DRIVEN DEVELOPMENT - TEMPLATES




                                           INTRODUCTION TO AGILE              24
                                       ©2011 Capgemini. All Rights Reserved
GENERATE MANY THINGS E.G. TABLE CREATE SCRIPTS




                                                INTRODUCTION TO AGILE              25
                                            ©2011 Capgemini. All Rights Reserved
GENERATING CODE
A quick example
A SIMPLE SMART USE CASE MODEL

       uc Manage Customer



                                                               «search»
                                                            Select Customer


                                          «incl ude»




                             «master detail»
                            Manage Customer
       Site Administrator
         (from A ctors)
                                                 «extend»

                                                                 «define»
                                                               Define Contact




                                                                                    INTRODUCTION TO AGILE              27
                                                                                ©2011 Capgemini. All Rights Reserved
A SIMPLE DOMAIN MODEL

      class Budapest.Business

              «business class»                  «business class»
                 Cust omer                          Cont act
         +   Name: string              +   Name: string
         +   Address: string         * +   Email: Email [0..1]
         +   Postcode: Postcode        +   Phone: PhoneNumber [0..1]
         +   City: string              +   Department: Departments
         +   Country: SmartRef
         +   Website: Url [0..1]




                                   «enumeration»
                                    Depart ments
                                   Sal es
                                   Purchasing
                                   Helpdesk
                                   Management




                                                                           INTRODUCTION TO AGILE              28
                                                                       ©2011 Capgemini. All Rights Reserved
USING TOBAGO MDA




                       INTRODUCTION TO AGILE              29
                   ©2011 Capgemini. All Rights Reserved
GENERATED CODE IN ASP.NET




                                INTRODUCTION TO AGILE              30
                            ©2011 Capgemini. All Rights Reserved
GENERATED CODE IN SILVERLIGHT




                                    INTRODUCTION TO AGILE              31
                                ©2011 Capgemini. All Rights Reserved
WWW.SMARTUSECASE.COM
www.accelerateddeliveryplatform.com
REFERENCES AND QUESTIONS
sander.hoogendoorn@capgemini.com
www.sanderhoogendoorn.com | www.smartusecase.com | www.accelerateddeliveryplatform.com
@aahoogendoorn

Model driven development using smart use cases and domain driven design

  • 1.
    MODEL DRIVEN DEVELOPMENT Withsmart use cases, domain driven design and Tobago MDA
  • 2.
    SANDER HOOGENDOORN Capgemini Principal technology officer Chief architect Accelerated Delivery Platform (ADP) Global agile thought leader Other Author books and articles Speaker at international conferences Microsoft Partner Advisory Council .NET Capping IT Off Blog Magazine columns Editorial boards & Advisory boards Web www.sanderhoogendoorn.com www.smartusecase.com Twitter: @aahoogendoorn LinkedIn: aahoogendoorn INTRODUCTION TO AGILE 2 ©2011 Capgemini. All Rights Reserved
  • 3.
    AGENDA Today’s topics Smart use cases Domain driven design Software architecture Model driven development with Tobago MDA Generating code with Tobago MDA Demo(s)! INTRODUCTION TO AGILE 3 ©2011 Capgemini. All Rights Reserved
  • 4.
    SMART USE CASES AYAGNI approach to requirements
  • 5.
    AGILE REQUIREMENTS -APPROACH Cloud Level Kite Level Sea Level Fish Level B D A Hierarchical E A D D Processes B C F Use Cases Smart Project Hierarchical C Use Cases Scope Processes D Chronological Processes INTRODUCTION TO AGILE 5 ©2011 Capgemini. All Rights Reserved
  • 6.
    CLOUD LEVEL INTRODUCTION TO AGILE 6 ©2011 Capgemini. All Rights Reserved
  • 7.
    KITE LEVEL INTRODUCTION TO AGILE 7 ©2011 Capgemini. All Rights Reserved
  • 8.
    MODELING SMART USECASES – SEA AND FISH LEVEL INTRODUCTION TO AGILE 8 ©2011 Capgemini. All Rights Reserved
  • 9.
  • 10.
    DOMAIN DRIVEN DEVELOPMENT Abrief introduction
  • 11.
    DOMAIN DRIVEN DEVELOPMENT- VOCABULARY Entity Object in the domain model not defined by its attributes, but by a thread of continuity and identity Value object Has no conceptual identity. Describe a characteristic of a thing Repository Methods for retrieving domain objects should delegate to a specialized 'repository' object such that alternative implementations may be easily interchanged. Factory Methods for creating domain objects should delegate to a specialized 'factory' object such that alternative implementations may be easily interchanged. Service Implement if an operation does not conceptually belong to any entity Implement these operations in services INTRODUCTION TO AGILE 11 ©2011 Capgemini. All Rights Reserved
  • 12.
    DOMAIN DRIVEN DEVELOPMENT– EXTENDED VOCABULARY Enumeration * Restricted and limited set of possible values Apply only when set of values never changes Smart reference * Generic reference entity Restricted but unlimited list of possible values Apply when only reference matters, not additional values, like in reports or drop downs INTRODUCTION TO AGILE 12 ©2011 Capgemini. All Rights Reserved
  • 13.
  • 14.
    ENTITY ATTRIBUTES –TYPES OF ATTRIBUTES Basic types string, integer, DateTime Including nullable wrapping Enumerations Genders, Categories Value objects No specific instances Isbn, Postcode, Bsn Simple references Smart references, such as Language, County Associations Other entities such as Customer, Product Within or outside aggregate INTRODUCTION TO AGILE 14 ©2011 Capgemini. All Rights Reserved
  • 15.
    VALUE OBJECT –IN USE INTRODUCTION TO AGILE 15 ©2011 Capgemini. All Rights Reserved
  • 16.
    SMART REFERENCE -TABLE INTRODUCTION TO AGILE 16 ©2011 Capgemini. All Rights Reserved
  • 17.
    SMART REFERENCE –IN USE INTRODUCTION TO AGILE 17 ©2011 Capgemini. All Rights Reserved
  • 18.
    SOFTWARE ARCHITECTURE A truerequirements for model driven development
  • 19.
    Pages Presentation UserControls Panels Use cases Process Workflow Domain objects / Entities Domain Factories / Repositories Enums / Value objects / Smart references [Mapping] Table Gateways Data / Services Queries [Mapping] Outside world Database INTRODUCTION TO AGILE 19 ©2011 Capgemini. All Rights Reserved
  • 20.
  • 21.
    User interface Software Architecture specification 1. Map your 5. Finalize your business processes application Existing to smart use cases Applications Smart use cases Forms Use cases 4. Generate your code using Tobago MDA a text template Frameworks Specifications engine Domain Domain Model objects Data / Service Business classes models 2. Set up your Test 3. Establish scenario’s domain model your software Databases architecture(s) INTRODUCTION TO AGILE 21 ©2011 Capgemini. All Rights Reserved
  • 22.
    MODEL DRIVEN DEVELOPMENT– TEMPLATE ENGINES Characteristics Load UML model (expressed in XMI) Load templates (from flat files) Combine elements from UML model with templates to generate deliverables Templates Templates contains code that runs in template engine Templates might use a folder model Generation process Ability to generate all or individual UML model elements Which UML model elements are supported? Generated deliverables can be code but also any other document type INTRODUCTION TO AGILE 22 ©2011 Capgemini. All Rights Reserved
  • 23.
    MODEL DRIVEN DEVELOPMENT- TEMPLATE ENGINES Properties can be used in templates Template engine knows (part of) the UML meta model INTRODUCTION TO AGILE 23 ©2011 Capgemini. All Rights Reserved
  • 24.
    MODEL DRIVEN DEVELOPMENT- TEMPLATES INTRODUCTION TO AGILE 24 ©2011 Capgemini. All Rights Reserved
  • 25.
    GENERATE MANY THINGSE.G. TABLE CREATE SCRIPTS INTRODUCTION TO AGILE 25 ©2011 Capgemini. All Rights Reserved
  • 26.
  • 27.
    A SIMPLE SMARTUSE CASE MODEL uc Manage Customer «search» Select Customer «incl ude» «master detail» Manage Customer Site Administrator (from A ctors) «extend» «define» Define Contact INTRODUCTION TO AGILE 27 ©2011 Capgemini. All Rights Reserved
  • 28.
    A SIMPLE DOMAINMODEL class Budapest.Business «business class» «business class» Cust omer Cont act + Name: string + Name: string + Address: string * + Email: Email [0..1] + Postcode: Postcode + Phone: PhoneNumber [0..1] + City: string + Department: Departments + Country: SmartRef + Website: Url [0..1] «enumeration» Depart ments Sal es Purchasing Helpdesk Management INTRODUCTION TO AGILE 28 ©2011 Capgemini. All Rights Reserved
  • 29.
    USING TOBAGO MDA INTRODUCTION TO AGILE 29 ©2011 Capgemini. All Rights Reserved
  • 30.
    GENERATED CODE INASP.NET INTRODUCTION TO AGILE 30 ©2011 Capgemini. All Rights Reserved
  • 31.
    GENERATED CODE INSILVERLIGHT INTRODUCTION TO AGILE 31 ©2011 Capgemini. All Rights Reserved
  • 32.
  • 33.
    REFERENCES AND QUESTIONS sander.hoogendoorn@capgemini.com www.sanderhoogendoorn.com| www.smartusecase.com | www.accelerateddeliveryplatform.com @aahoogendoorn