MDA: Smarter development of Java EE applications Richard van der Laan  Tony Sloos  <logo>
Agenda Basic Principles Ingredients for “Pragmatic MDA” By Example: Starting from scratch Taking advantage of Seam and EJB 3.0 From meta-model to code with EA and Freemarker Questions & Demo
Speakers Background Tony Sloos  –   independent architect Field of activity: strategy, architecture & implementation guidance/governance Specializations : Java EE, frameworks & model-based development <logo> Richard van der Laan  –   software architect Field of activity: architecture & multi-disciplinary product development Specializations : high-tech automation, distributed services, model-based development
Model Driven Architecture Defined by the OMG (2001) Conceptual framework for using models and applying transformations between models Driven by the activity of modeling systems Expected Bottom-line benefits: Less development costs Improved quality Shorter time to market
MDA Process Build models with high level of abstraction (independent of implementation) Transform models into specific models (specifying implementation constructs) Transform models into code PIM Working software PSM CIM Transformation
MDA Process Build models with high level of abstraction (independent of implementation) Transform models into specific models (specifying implementation constructs) Transform models into code PIM Working software PSM CIM Transformation
Top-down vs Bottom-up Working software Models PIM PSM Top-down Bottom-up Transformation Skilled Transformation Capture domain information Transformation Capture technical information Simple tools (whiteboards) Modify code As needed
Pragmatic approach to MDA Introduce MDA where it makes sense MDA as a means, not as a goal! Balance between Top-down and Bottom-up First understand, then automate! Be Pragmatic: Start Bottom-up From Code to Models Start with the Working Code Well defined Technology Stack Make use of standardized  frameworks aiming on solution space Models Code
Bottom Up : Target Architecture Start with analyzing the current situation in code Discover patterns: Repetitive patterns in artifacts Variation points in the architecture Faulty sensitive artifacts Artifacts partitioned across  different technologies Patterns Platform indep. model Target architecture Domain model
Bottom Up : Target Architecture It makes no sense modeling the  PSM layer  when the target architecture is known! Capture platform specific details in transformation rules Platform specific model Transformation Platform indep. model Target architecture Domain model
Bottom Up : Domain Model Concepts Capture domain concepts from  problem space Use  stereotyping  to embody model in software Define meaning of model elements Define mapping on target architecture in  solution space Domain-Driven Design We apply the systematic  approach by Eric Evans Platform indep. model Target architecture Domain model
MDA Toolchain : Pick your tools! UML modeling tools Eclipse EMF, Enterprise Architect, Magic Draw  (XMI compliancy eases metadata interchange) MDA generator frameworks oAW, AndroMDA, OpenMDX, Acceleo Model-to-model transformation oAW Xtend, OMG QVT Operational Model-to-text (code) transformation oAW XPand, JET, FreeMarker template engine
Ingredients for pragmatic MDA A well-defined  Technology Stack A well-defined  Target Architecture A well-defined Automation Scope Mix the right ingredients Apply a short development cycle Code Patterns Meta model Models Templates
Ingredient 1: Technology-stack
Ingredient 2: Target-architecture
Ingredient 3: Automation-goals Stereotype Generator Artifacts
Basic Principles Application Aspect Target Architecture Translation Stereotype Template Engine Approach Artifacts Translation 1 1..n
Basic Principles: by example Entities Application Aspect Template Engine POJO + ORM Target Architecture Translation Entity Class JPA Config DAO Class Artifacts <<DomainEntity>> Stereotype Translation DDD (Eric Evans) Approach
By Example Conference Administration as a Service (CAaaS) WS1 Registration Service Schedule Service WS2 Domain Model RIA (Silverlight) Access Logic Data Persistency Client Domain Facades Business Facades
By Example Domain Model
By Example Domain Facade
By Example Domain Logic
By Example Web Service Fine-tuning with “Tagged Values” in EA Facades use a canonical data model (CDM) to allow XSD-based data contracts
Stereotypes with a background Mapped on Target Architecture
Room for hand-crafting! Seam injection is used to merge “custom code” Seam component (separate class) holds “custom code”
From meta-model to code Step 1    Build your meta-model Create your meta-model in EA using predefined meta-types and object-orientation Properties in your meta-model become tagged-values in your model
From meta-model to code Step 2    Save your meta-model as UML 2.0 Profile Export meta-model as UML 2.0 Profile Import UML 2.0 Profile into your model Ready to model!
From meta-model to code Step 3    Take your pick and model... Your own stereotypes in EA Drag-and-Drop from toolbox to diagram
From meta-model to code Step 4a    Generate artifacts (update/build process) The template engine transforms stereotypes into artifacts Ant-task/Maven that runs template engine within Ecplise and Hudson:  Freemarker (www.freemarker.org) Freemarker Pre-processor (fmpp.sourcefourge.net)
From meta-model to code Step 4b    Generate artifacts (template engine) Ant-task EA repository EA api FMPP Template Models (java class) Templates Templates Templates Templates DomainEnumeration.ftl
From meta-model to code Step 4c    Generate artifacts (output) Java Entity Java DAO C# Entity Hibernate mapping XSD Type
Are you ready for MDA? Apply a pragmatic approach Look beyond the tooling to make MDA work Use a systematic approach to domain modeling Tailor your UML profile Aim for specific PSM transformations  Mix the right ingredients: Well-defined Technology Stack Well-defined Target Architecture Well-defined Automation Scope
[email_address] [email_address] Time for a demo and questions…

Final Jspring2009 Mda Slimmer Ontwikkelen Van Java Ee Applicaties

  • 1.
    MDA: Smarter developmentof Java EE applications Richard van der Laan Tony Sloos <logo>
  • 2.
    Agenda Basic PrinciplesIngredients for “Pragmatic MDA” By Example: Starting from scratch Taking advantage of Seam and EJB 3.0 From meta-model to code with EA and Freemarker Questions & Demo
  • 3.
    Speakers Background TonySloos – independent architect Field of activity: strategy, architecture & implementation guidance/governance Specializations : Java EE, frameworks & model-based development <logo> Richard van der Laan – software architect Field of activity: architecture & multi-disciplinary product development Specializations : high-tech automation, distributed services, model-based development
  • 4.
    Model Driven ArchitectureDefined by the OMG (2001) Conceptual framework for using models and applying transformations between models Driven by the activity of modeling systems Expected Bottom-line benefits: Less development costs Improved quality Shorter time to market
  • 5.
    MDA Process Buildmodels with high level of abstraction (independent of implementation) Transform models into specific models (specifying implementation constructs) Transform models into code PIM Working software PSM CIM Transformation
  • 6.
    MDA Process Buildmodels with high level of abstraction (independent of implementation) Transform models into specific models (specifying implementation constructs) Transform models into code PIM Working software PSM CIM Transformation
  • 7.
    Top-down vs Bottom-upWorking software Models PIM PSM Top-down Bottom-up Transformation Skilled Transformation Capture domain information Transformation Capture technical information Simple tools (whiteboards) Modify code As needed
  • 8.
    Pragmatic approach toMDA Introduce MDA where it makes sense MDA as a means, not as a goal! Balance between Top-down and Bottom-up First understand, then automate! Be Pragmatic: Start Bottom-up From Code to Models Start with the Working Code Well defined Technology Stack Make use of standardized frameworks aiming on solution space Models Code
  • 9.
    Bottom Up :Target Architecture Start with analyzing the current situation in code Discover patterns: Repetitive patterns in artifacts Variation points in the architecture Faulty sensitive artifacts Artifacts partitioned across different technologies Patterns Platform indep. model Target architecture Domain model
  • 10.
    Bottom Up :Target Architecture It makes no sense modeling the PSM layer when the target architecture is known! Capture platform specific details in transformation rules Platform specific model Transformation Platform indep. model Target architecture Domain model
  • 11.
    Bottom Up :Domain Model Concepts Capture domain concepts from problem space Use stereotyping to embody model in software Define meaning of model elements Define mapping on target architecture in solution space Domain-Driven Design We apply the systematic approach by Eric Evans Platform indep. model Target architecture Domain model
  • 12.
    MDA Toolchain :Pick your tools! UML modeling tools Eclipse EMF, Enterprise Architect, Magic Draw (XMI compliancy eases metadata interchange) MDA generator frameworks oAW, AndroMDA, OpenMDX, Acceleo Model-to-model transformation oAW Xtend, OMG QVT Operational Model-to-text (code) transformation oAW XPand, JET, FreeMarker template engine
  • 13.
    Ingredients for pragmaticMDA A well-defined Technology Stack A well-defined Target Architecture A well-defined Automation Scope Mix the right ingredients Apply a short development cycle Code Patterns Meta model Models Templates
  • 14.
  • 15.
  • 16.
    Ingredient 3: Automation-goalsStereotype Generator Artifacts
  • 17.
    Basic Principles ApplicationAspect Target Architecture Translation Stereotype Template Engine Approach Artifacts Translation 1 1..n
  • 18.
    Basic Principles: byexample Entities Application Aspect Template Engine POJO + ORM Target Architecture Translation Entity Class JPA Config DAO Class Artifacts <<DomainEntity>> Stereotype Translation DDD (Eric Evans) Approach
  • 19.
    By Example ConferenceAdministration as a Service (CAaaS) WS1 Registration Service Schedule Service WS2 Domain Model RIA (Silverlight) Access Logic Data Persistency Client Domain Facades Business Facades
  • 20.
  • 21.
  • 22.
  • 23.
    By Example WebService Fine-tuning with “Tagged Values” in EA Facades use a canonical data model (CDM) to allow XSD-based data contracts
  • 24.
    Stereotypes with abackground Mapped on Target Architecture
  • 25.
    Room for hand-crafting!Seam injection is used to merge “custom code” Seam component (separate class) holds “custom code”
  • 26.
    From meta-model tocode Step 1  Build your meta-model Create your meta-model in EA using predefined meta-types and object-orientation Properties in your meta-model become tagged-values in your model
  • 27.
    From meta-model tocode Step 2  Save your meta-model as UML 2.0 Profile Export meta-model as UML 2.0 Profile Import UML 2.0 Profile into your model Ready to model!
  • 28.
    From meta-model tocode Step 3  Take your pick and model... Your own stereotypes in EA Drag-and-Drop from toolbox to diagram
  • 29.
    From meta-model tocode Step 4a  Generate artifacts (update/build process) The template engine transforms stereotypes into artifacts Ant-task/Maven that runs template engine within Ecplise and Hudson: Freemarker (www.freemarker.org) Freemarker Pre-processor (fmpp.sourcefourge.net)
  • 30.
    From meta-model tocode Step 4b  Generate artifacts (template engine) Ant-task EA repository EA api FMPP Template Models (java class) Templates Templates Templates Templates DomainEnumeration.ftl
  • 31.
    From meta-model tocode Step 4c  Generate artifacts (output) Java Entity Java DAO C# Entity Hibernate mapping XSD Type
  • 32.
    Are you readyfor MDA? Apply a pragmatic approach Look beyond the tooling to make MDA work Use a systematic approach to domain modeling Tailor your UML profile Aim for specific PSM transformations Mix the right ingredients: Well-defined Technology Stack Well-defined Target Architecture Well-defined Automation Scope
  • 33.
    [email_address] [email_address] Timefor a demo and questions…