Pragmatic model driven development in Java using
 smart use cases and domain driven development
               Sander Hoog...
Sander Hoogendoorn

Capgemini
   Principal technology officer
   Capgemini agile thought leader
   Certifiedglobal soft...
Rody Middelkoop

Avisi
   Technical consultant
Hogeschool Arnhem Nijmegen (HAN)
   Lecturer Software Engineering
Other
 ...
Agenda

Introduction
    Model driven development
    Pragmatic model driven development
    Ourapproach
    Benefite
...
Model driven development
        An introduction




                          TWO GUYS TRYING TO TALK REALLY FAST AND BUI...
Model driven development                                                                                                  ...
A pragmaticapproach
  To model driven development




                      TWO GUYS TRYING TO TALK REALLY FAST AND BUILD ...
User interface                Software Architecture
                                       specification
                 ...
Smart use cases
What makes a use cases smart?




                      TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN A...
Different levels of use cases
                                           Merge
                                         co...
Different levels of use cases

‘Regular’ use cases
                                                                       ...
Modeling smart use cases



                TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES            ...
Modeling smart use cases

Approach
  Create a use case diagram for each
   elementary business process
  Model a (user g...
Identifying sub-function level use cases

Guidelines
   Identify re-use
   Model one form per use case
   Model one use...
Modeling smart use cases




                           TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES...
Smart use case stereotypes
       Decorating the model




                        TWO GUYS TRYING TO TALK REALLY FAST AND...
Smart use case stereotypes                                                                                           RM


...
Adding stereotypes                                                                                SH




                 ...
Adding stereotypes




                     TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES            ...
Smart use case stereotypes




                             TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MIN...
Mapping to software architecture
      Smart use cases and domain design




                              TWO GUYS TRYING...
Pages
                                                                   UserControls
Presentation
                       ...
Pages
                                                                                           UserControls
Presentation...
Service contracts
Presentation                                                         Operation contracts
               ...
Domain driven design
     A brief introduction




                       TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN...
Domain driven design

Definition
   Base complex domain designs on the model
   Primary focus is on the domain and domai...
Domain driven design

Vocabulary
   Entity / Domain object
   Association
   Value object
   Aggregate
   Repository
...
Example – Class diagram




                          TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES  ...
Defining classes
Properties and property types




                      TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN ...
Properties and property types                                                                                             ...
Value object



          TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES                 31
          ...
Value object - Implementing




                              TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 M...
Value object – In use




                        TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES      ...
Smart reference



           TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES                 34
      ...
Smart reference - Table




                          TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES  ...
Smart reference - In entity




                              TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 M...
Smart reference – In use




                           TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES...
Text templating



           TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES                 38
      ...
Model driven development – Template engines                                                                          SH


...
Tobago MDA – www.accelerateddeliveryplatform.com




                                 TWO GUYS TRYING TO TALK REALLY FAST ...
Tobago MDA




             TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES                 41
        ...
Tobago MDA




             TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES                 42
        ...
Model driven development - Template engines                                                                   RM




     ...
Freemarker
                                                                                 Sitemesh
Presentation
        ...
Model driven development - Templates




                                  TWO GUYS TRYING TO TALK REALLY FAST AND BUILD A...
Generate many things e.g. Table create scripts




                                     TWO GUYS TRYING TO TALK REALLY FAS...
Generate many things e.g. Table create scripts




                                     TWO GUYS TRYING TO TALK REALLY FAS...
FAQ
You




      TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES                 48
                  ...
FAQ                                                                                                    SH



Yes
No
I don’...
Generating code
     Demo!




             TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES            ...
www.accelerateddeliveryplatform.com                                                                           SH




     ...
References and questions
        www.accelerateddeliveryplatform.com

        sander.hoogendoorn@capgemini.com
           ...
Upcoming SlideShare
Loading in...5
×

Pragmatic Model Driven Development In Java Using Smart Use Cases

1,138

Published on

The talk that Sander Hoogendoorn and I did on the J-Spring 2009.

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,138
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Pragmatic Model Driven Development In Java Using Smart Use Cases

  1. 1. Pragmatic model driven development in Java using smart use cases and domain driven development Sander Hoogendoorn, Capgemini Rody Middelkoop, Avisi TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 1 © Copyright Capgemini2008 All Rights Reserved
  2. 2. Sander Hoogendoorn Capgemini  Principal technology officer  Capgemini agile thought leader  Certifiedglobal software engineer (SE4)  Chief architect Accelerated Delivery Platform Other  Author books (UML, agile) and articles  Speaker at conferences  Microsoft Partner Advisory Council .NET  Columnist Software Release Magazine, SDN Magazine  Editorial board Software Release Magazine  Editorial board Tijdschrift IT Management  Advisory board @Portunity  Member expert panel Computable Web  www.sanderhoogendoorn.com  www.accelerateddeliveryplatform.com TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 2 © Copyright Capgemini2008 All Rights Reserved
  3. 3. Rody Middelkoop Avisi  Technical consultant Hogeschool Arnhem Nijmegen (HAN)  Lecturer Software Engineering Other  Sun Certified Java Programmer / Developer  Author of severalarticles  ContributorLivre  Speaker at conferences Web  www.avisi.nl  rodymiddelkoop.blogspot.com TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 3 © Copyright Capgemini2008 All Rights Reserved
  4. 4. Agenda Introduction  Model driven development  Pragmatic model driven development  Ourapproach  Benefite Smart use cases  Modeling smart use cases  Smart use cases in code Domain driven design  Domain objects  Smart references  Value objects Generating code  Text templating  Using Tobago MDA Demo’s TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 4 © Copyright Capgemini2008 All Rights Reserved
  5. 5. Model driven development An introduction TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 5 © Copyright Capgemini2008 All Rights Reserved
  6. 6. Model driven development SH Why?  Bridge gap between design and code  Improvequality of delivered software  Raiseproductivity  Achieve platform and framework independency  Increasetestability How?  Proprietarytechniques  DSL’s (textual and graphical)  UML  Database  India What?  Modeling tool code generation  Development tool code generation  Intermediate code generation TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 6 © Copyright Capgemini2008 All Rights Reserved
  7. 7. A pragmaticapproach To model driven development TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 7 © Copyright Capgemini2008 All Rights Reserved
  8. 8. User interface Software Architecture specification 1. Map your 5. Finalize your business processes application to smart use cases Existing Applications Smart use cases Forms Use cases 4. Generate code using a Tobago text template Frameworks MDA engine Specifications Domain Domain objects Model Data / Service Business classes models 2. Create the Test 3. Establish scenario’s domain model your software Databases architecture(s) TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 8 © Copyright Capgemini2008 All Rights Reserved
  9. 9. Smart use cases What makes a use cases smart? TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 9 © Copyright Capgemini2008 All Rights Reserved
  10. 10. Different levels of use cases Merge companies Cloud level High summary Merge mortgage systems Kite level Summary Place order Sea level User goal Fish level Sub-function Select product Clam level Too low Insert orderline TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 10 © Copyright Capgemini2008 All Rights Reserved
  11. 11. Different levels of use cases ‘Regular’ use cases Regular Smart  Only user goal level use cases use case use case  Use cases ‘as they are intended’  A single use case describes Format Textual Visual a single elementary business process  Differ in granularity too much Very Granularity Unified different  Law of Large Numbers does not apply Smart use cases Estimates Hard Easier  User goal and sub function level use cases  Good unit of work and estimation Unit of work Lousy Good  A single elementary business process is modeled in a single use case diagram Re-use Incidental Normal  A single user goal level use case + auxiliary use cases at sub-function level  Very similar granularity Traceability Possible Likely in code TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 11 © Copyright Capgemini2008 All Rights Reserved
  12. 12. Modeling smart use cases TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 12 © Copyright Capgemini2008 All Rights Reserved
  13. 13. Modeling smart use cases Approach  Create a use case diagram for each elementary business process  Model a (user goal level) use case that maps to the elementary business process  Name it after the elementary business process  Identify the actors executing the use case  Identify the sub-function level use cases  Model include and extend relationships  Identify supporting actors TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 13 © Copyright Capgemini2008 All Rights Reserved
  14. 14. Identifying sub-function level use cases Guidelines  Identify re-use  Model one form per use case  Model one use case per functional web part  Isolate unknown functionality  Identify complex functionality  Show extensive reporting  Model complex calculations  Isolate interaction with others  Avoid low level (database) interaction TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 14 © Copyright Capgemini2008 All Rights Reserved
  15. 15. Modeling smart use cases TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 15 © Copyright Capgemini2008 All Rights Reserved
  16. 16. Smart use case stereotypes Decorating the model TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 16 © Copyright Capgemini2008 All Rights Reserved
  17. 17. Smart use case stereotypes RM What?  Classify model elements  Do notaddmeaning to model  Definecustom stereotypes Why?  Speed up analysis and design  Map design to software architecture  Generatelots of code!  Standardizefunctional testing TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 17 © Copyright Capgemini2008 All Rights Reserved
  18. 18. Adding stereotypes SH TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 18 © Copyright Capgemini2008 All Rights Reserved
  19. 19. Adding stereotypes TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 19 © Copyright Capgemini2008 All Rights Reserved
  20. 20. Smart use case stereotypes TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 20 © Copyright Capgemini2008 All Rights Reserved
  21. 21. Mapping to software architecture Smart use cases and domain design TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 21 © Copyright Capgemini2008 All Rights Reserved
  22. 22. Pages UserControls Presentation Panels Use cases Process Workflow Domain objects / Entities Factories / Repositories Domain Enums / Value objects / Smart references [Mapping] Table Gateways Queries Data / Services [Mapping] Outside world Database TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 22 © Copyright Capgemini2008 All Rights Reserved
  23. 23. Pages UserControls Presentation Panels Use cases Process Workflow Domain objects / Entities Factories / Repositories Domain Enums / Value objects / Smart references [Mapping] Service gateways Service locators Data / Services [Mapping] Exact SAP BizTalk Java Outside world Services / ESB TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 23 © Copyright Capgemini2008 All Rights Reserved
  24. 24. Service contracts Presentation Operation contracts Data contracts Use cases Process Services Domain objects / Entities Factories / Repositories Domain Enums / Value objects / Smart references [Mapping] TableGateways / Service Gateways Data / Services Queries / Service Locators [Mapping] Exact SAP BizTalk Java Database Outside world Services / ESB TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 24 © Copyright Capgemini2008 All Rights Reserved
  25. 25. Domain driven design A brief introduction TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 25 © Copyright Capgemini2008 All Rights Reserved
  26. 26. Domain driven design Definition  Base complex domain designs on the model  Primary focus is on the domain and domain logic In practice  Model the domain  Apply the extended domain driven vocabulary  Build the domain layer  Hook in process layer  Plug in data / services layer Useful when  The domain of your application is core  Two tier is not (never?) desirable  Application needs to function independent of back office, data sources or services TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 26 © Copyright Capgemini2008 All Rights Reserved
  27. 27. Domain driven design Vocabulary  Entity / Domain object  Association  Value object  Aggregate  Repository  Factory  Service Additional vocabulary  Enumeration  Smart reference TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 27 © Copyright Capgemini2008 All Rights Reserved
  28. 28. Example – Class diagram TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 28 © Copyright Capgemini2008 All Rights Reserved
  29. 29. Defining classes Properties and property types TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 29 © Copyright Capgemini2008 All Rights Reserved
  30. 30. Properties and property types RM Basic types  string, integer, DateTime  Include nullable wrapping Enumerations  Set up at design time, unchangeable at run-time  Genders, Categories Value objects  No specific instances  Isbn, Email, Url, Money Smart references  Changeable at run-time, such as ContractType Associations  Cached domain objects such as Country, Nationality  First level citizens such as Customer, Product TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 30 © Copyright Capgemini2008 All Rights Reserved
  31. 31. Value object TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 31 © Copyright Capgemini2008 All Rights Reserved
  32. 32. Value object - Implementing TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 32 © Copyright Capgemini2008 All Rights Reserved
  33. 33. Value object – In use TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 33 © Copyright Capgemini2008 All Rights Reserved
  34. 34. Smart reference TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 34 © Copyright Capgemini2008 All Rights Reserved
  35. 35. Smart reference - Table TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 35 © Copyright Capgemini2008 All Rights Reserved
  36. 36. Smart reference - In entity TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 36 © Copyright Capgemini2008 All Rights Reserved
  37. 37. Smart reference – In use TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 37 © Copyright Capgemini2008 All Rights Reserved
  38. 38. Text templating TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 38 © Copyright Capgemini2008 All Rights Reserved
  39. 39. Model driven development – Template engines SH How?  Define project  Define patterns  Import model  Generate deliverable  Finalize code Additional features  Combine model elements  Combine types of model elements  Remember location Changing the model withourlosing code  Partial classes  Inherited classes  Marking code TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 39 © Copyright Capgemini2008 All Rights Reserved
  40. 40. Tobago MDA – www.accelerateddeliveryplatform.com TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 40 © Copyright Capgemini2008 All Rights Reserved
  41. 41. Tobago MDA TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 41 © Copyright Capgemini2008 All Rights Reserved
  42. 42. Tobago MDA TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 42 © Copyright Capgemini2008 All Rights Reserved
  43. 43. Model driven development - Template engines RM Properties can be used in templates Template engine knows (part of) the UML meta model TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 43 © Copyright Capgemini2008 All Rights Reserved
  44. 44. Freemarker Sitemesh Presentation DisplayTag Struts2 Process XWorkActions Spring EJB3 Services EJB3 DataAccessObjects Data / Services Spring JPA Domain objects Enums Domain Value objects Smart references Outside world MySQL TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 44 © Copyright Capgemini2008 All Rights Reserved
  45. 45. Model driven development - Templates TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 45 © Copyright Capgemini2008 All Rights Reserved
  46. 46. Generate many things e.g. Table create scripts TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 46 © Copyright Capgemini2008 All Rights Reserved
  47. 47. Generate many things e.g. Table create scripts TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 47 © Copyright Capgemini2008 All Rights Reserved
  48. 48. FAQ You TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 48 © Copyright Capgemini2008 All Rights Reserved
  49. 49. FAQ SH Yes No I don’t know I am not allowed to go into details about this TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 49 © Copyright Capgemini2008 All Rights Reserved
  50. 50. Generating code Demo! TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 50 © Copyright Capgemini2008 All Rights Reserved
  51. 51. www.accelerateddeliveryplatform.com SH TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 51 © Copyright Capgemini2008 All Rights Reserved
  52. 52. References and questions www.accelerateddeliveryplatform.com sander.hoogendoorn@capgemini.com r.r.middelkoop@avisi.nl Twitter: aahoogendoorn LinkedIn: aahoogendoornrodym TWO GUYS TRYING TO TALK REALLY FAST AND BUILD AN APP IN 45 MINUTES 52 © Copyright Capgemini2008 All Rights Reserved

×