Model-Driven Development for Agile Projects
Objectives

• Drive down development time and costs and increase product
  quality
• Proactively head off technical debt and ensure architectural
  integrity
• Jump start development projects with proven conventions
• Attain solution space knowledge continuity
• Drive down maintenance costs
• Enable platform-level refactoring
Balance Concerns



Architectura                       Rapid
 l Integrity                      Delivery
Why Model?

• Models provide a representation of problem and solution
  space knowledge that is portable and persistent

• Common lexicon for communicating concepts and building
  understanding across all developers

• Picture is worth 1000 words

• Basis for conversation about the relationships of key
  abstractions in a system
Software is Executable Knowledge*

• Books and similar media contain static knowledge
• Software encapsulates knowledge about how to solve a
  problem in such a way that the application of that knowledge
  can be automated
• Model-driven development allows us to use software to
  automate our knowledge about how to implement software
  systems




                                              * Of Zeppelins and Jet Planes; Phil Armour
Model-Driven Architecture Theory

• A methodology wherein system functionality is defined as a
  platform-independent model, using an appropriate
  specification language and then translated to one or more
  platform-specific models for the actual implementation

• The executable software is an output of a system which takes a
  technology-independent description of the solution as an input
Not Just Code Generation

• A way to continuously encapsulate new development
  knowledge in ways that can automate development
• Retain key business knowledge across heterogeneous
  technologies
• Allow developers to focus their creativity on parts of
  the system that matter the most to users
• Not just point-in-time activity
Types of Models

• Platform-Independent Model (PIM)
   – Describes the business concerns of an application in a technology-agnostic
     way
   – Bridges between problem and solution spaces
   – Holds true regardless of what technology is used to implement the system


• Platform-Specific Model (PSM)
   – Describes how the PIM will be realized using a specific set of implementation
     technologies (e.g. Java, .NET, Ruby, Objective-C, etc.)
   – Describes the implementation mechanisms of a system
   – PIM can be implemented using any number of PSMs
Keep Models Simple

• Pick a terse domain-specific language for the PIM
• The more complex the modeling language and
  conventions, the less effective it will be in
  communicating the essential information
• Don’t try to model everything
• “Advances” like UML 2.0 actually went the other
  direction
   – Made modeling less accessible
   – Irony is the goal was to better enable MDA
Example DSL For Software Systems

• Entities
   – Things that have state
• Controls
   – Things that orchestrate interaction between entities to realize
     some functionality
• Boundaries
   – Sit between external actors and the system
• Enumerations
   – A fixed list of values
• Primitives
   – Simple, atomic types
Example Model
Codify Implementation Patterns

• Implementation patterns are platform-specific
• Architectural mechanisms
• Where do patterns come from?
   – Previous development projects
   – Prototypes
   – Other peoples’ projects
• Encapsulate pattern knowledge into transformation
  templates
• Defines the development conventions
Keep the Transformation Language Simple

• Minimum specification needed to access model
  elements

• Minimum utilities needed to handle string functions
  like capitalization

• Simple decision structures
Example Transformation Template
PIM + Transformations = Source Code
Benefits of MDD

• Improve developer productivity
   – Automate development of “plumbing” code
• Increase the value of each manually developed line
  of code
• Improve code quality and maintainability
   – Convention-based approach limits entry points for manual
     development
   – Code generation drives up code consistency
Benefits of MDD

• Spend more time understanding user needs!
• Rapidly adapt to changing needs
  – Refactor the templates to use new conventions or even
    new programming languages
  – Preserve platform-independent aspects of design
• Build systems that are self-documenting
• Spend less time starting new projects
• Decrease time to onboard new developers
Blending MDD and Agile

• Treat models as development artifacts not
  documentation artifacts
• Keep it simple
• Model and generate code continuously
• Make implementation knowledge executable to
  continually increase velocity
Minimize Waste & Keep it Simple
• Only model parts of system needed to implement current
  iteration’s stories
• Don’t try to model everything
   – Focus on key abstractions
   – Too much detail leads to models that are overly complex and
     difficult to maintain
• Don’t try to generate all the code
   – Doing so can lead to technical debt in the transformation
     templates
   – Only generate code for architectural mechanisms you actually
     need
   – If figuring out how to generate something seems tortured
     maybe it shouldn’t be generated!
Continuous Model Transformation

• Integrate model transformation into every build

• Ensures code and model are always in sync

• One-time or infrequent model transformations
   – Same negative effects as not doing CI with source code
   – Undermines value proposition of MDD altogether
CMT Implementation Strategy

• Put boilerplate code in
  immutable base classes
   – Re-generate immutable code
     every build
• Put hooks for manual
  development in leaf nodes
   – One-time generation of
     modifiable code, don’t re-
     generate
Balance Rigidity Against Flexibility




Rigidity                      Flexibility
Putting It Together
Structural key abstraction changes




                 PIM                                Non-Modifiable Code



                                               Value added behavioral and
Architecturally significant changes              user experience changes

                TT
                  T
          Transformations
                                                    Modifiable Code
MDD + Testing

• Enable test developers to focus on test logic
  development
• Use MDD to generate test helper components
   – User interface element finders
   – Access server components
• Do not generate verification logic
Atlas MDD Toolkit

• Open source (http://atlas-mda.org)
• Specifies a very simple DSL for describing systems
• Supports any modeling tool whose model representation
  can be adapted to the Atlas DSL
• Model transformations developed using Velocity open
  source template language
• Simple configuration of transformation target attributes
   – E.g. output path, overwrite, etc
• Easily pluggable into common build environments
   – Maven, Visual Studio, command line, etc
Support for PSM Guidance

• Platform-specific guidance when all the information
  needed to generate code doesn’t exist in the PIM
Simple Configuration
Atlas Maven Configuration

• Plugs into the generate sources target
Case Study 1 – Failed Project Rescue

• Previous vendor:
   – Took 3 years to deliver base functionality with unsustainable
     technical debt
   – Cost tens of millions of dollars
• Using MDD, our team:
   – Re-implemented base functionality and established new
     conventions and templates in 4 months
   – Added several new high-value features
   – Attained a 70/30 generated/hand-coded ratio
   – Cost less than one million dollars
   – Left the client with a model that described the system and a
     development platform to add new features
Case Study 2 – Bootstrap Development Team

• Initial agile seed team formulated conventions and
  architectural mechanisms during development of initial
  stories
   – Majority of technical complexity driven out
• Less experienced developers added to multiply
  development throughput
   – Conventions and plumbing already established
   – Most development was “between the braces”
   – New developers immediately productive
• Seed team detached and left less expensive, self-
  sufficient team in place
• Led to multi-million dollar follow-on award to add
  incremental functionality on product base

Agile MDD

  • 1.
  • 2.
    Objectives • Drive downdevelopment time and costs and increase product quality • Proactively head off technical debt and ensure architectural integrity • Jump start development projects with proven conventions • Attain solution space knowledge continuity • Drive down maintenance costs • Enable platform-level refactoring
  • 3.
    Balance Concerns Architectura Rapid l Integrity Delivery
  • 4.
    Why Model? • Modelsprovide a representation of problem and solution space knowledge that is portable and persistent • Common lexicon for communicating concepts and building understanding across all developers • Picture is worth 1000 words • Basis for conversation about the relationships of key abstractions in a system
  • 5.
    Software is ExecutableKnowledge* • Books and similar media contain static knowledge • Software encapsulates knowledge about how to solve a problem in such a way that the application of that knowledge can be automated • Model-driven development allows us to use software to automate our knowledge about how to implement software systems * Of Zeppelins and Jet Planes; Phil Armour
  • 6.
    Model-Driven Architecture Theory •A methodology wherein system functionality is defined as a platform-independent model, using an appropriate specification language and then translated to one or more platform-specific models for the actual implementation • The executable software is an output of a system which takes a technology-independent description of the solution as an input
  • 7.
    Not Just CodeGeneration • A way to continuously encapsulate new development knowledge in ways that can automate development • Retain key business knowledge across heterogeneous technologies • Allow developers to focus their creativity on parts of the system that matter the most to users • Not just point-in-time activity
  • 8.
    Types of Models •Platform-Independent Model (PIM) – Describes the business concerns of an application in a technology-agnostic way – Bridges between problem and solution spaces – Holds true regardless of what technology is used to implement the system • Platform-Specific Model (PSM) – Describes how the PIM will be realized using a specific set of implementation technologies (e.g. Java, .NET, Ruby, Objective-C, etc.) – Describes the implementation mechanisms of a system – PIM can be implemented using any number of PSMs
  • 9.
    Keep Models Simple •Pick a terse domain-specific language for the PIM • The more complex the modeling language and conventions, the less effective it will be in communicating the essential information • Don’t try to model everything • “Advances” like UML 2.0 actually went the other direction – Made modeling less accessible – Irony is the goal was to better enable MDA
  • 10.
    Example DSL ForSoftware Systems • Entities – Things that have state • Controls – Things that orchestrate interaction between entities to realize some functionality • Boundaries – Sit between external actors and the system • Enumerations – A fixed list of values • Primitives – Simple, atomic types
  • 11.
  • 12.
    Codify Implementation Patterns •Implementation patterns are platform-specific • Architectural mechanisms • Where do patterns come from? – Previous development projects – Prototypes – Other peoples’ projects • Encapsulate pattern knowledge into transformation templates • Defines the development conventions
  • 13.
    Keep the TransformationLanguage Simple • Minimum specification needed to access model elements • Minimum utilities needed to handle string functions like capitalization • Simple decision structures
  • 14.
  • 15.
    PIM + Transformations= Source Code
  • 16.
    Benefits of MDD •Improve developer productivity – Automate development of “plumbing” code • Increase the value of each manually developed line of code • Improve code quality and maintainability – Convention-based approach limits entry points for manual development – Code generation drives up code consistency
  • 17.
    Benefits of MDD •Spend more time understanding user needs! • Rapidly adapt to changing needs – Refactor the templates to use new conventions or even new programming languages – Preserve platform-independent aspects of design • Build systems that are self-documenting • Spend less time starting new projects • Decrease time to onboard new developers
  • 18.
    Blending MDD andAgile • Treat models as development artifacts not documentation artifacts • Keep it simple • Model and generate code continuously • Make implementation knowledge executable to continually increase velocity
  • 19.
    Minimize Waste &Keep it Simple • Only model parts of system needed to implement current iteration’s stories • Don’t try to model everything – Focus on key abstractions – Too much detail leads to models that are overly complex and difficult to maintain • Don’t try to generate all the code – Doing so can lead to technical debt in the transformation templates – Only generate code for architectural mechanisms you actually need – If figuring out how to generate something seems tortured maybe it shouldn’t be generated!
  • 20.
    Continuous Model Transformation •Integrate model transformation into every build • Ensures code and model are always in sync • One-time or infrequent model transformations – Same negative effects as not doing CI with source code – Undermines value proposition of MDD altogether
  • 21.
    CMT Implementation Strategy •Put boilerplate code in immutable base classes – Re-generate immutable code every build • Put hooks for manual development in leaf nodes – One-time generation of modifiable code, don’t re- generate
  • 22.
    Balance Rigidity AgainstFlexibility Rigidity Flexibility
  • 23.
    Putting It Together Structuralkey abstraction changes PIM Non-Modifiable Code Value added behavioral and Architecturally significant changes user experience changes TT T Transformations Modifiable Code
  • 24.
    MDD + Testing •Enable test developers to focus on test logic development • Use MDD to generate test helper components – User interface element finders – Access server components • Do not generate verification logic
  • 25.
    Atlas MDD Toolkit •Open source (http://atlas-mda.org) • Specifies a very simple DSL for describing systems • Supports any modeling tool whose model representation can be adapted to the Atlas DSL • Model transformations developed using Velocity open source template language • Simple configuration of transformation target attributes – E.g. output path, overwrite, etc • Easily pluggable into common build environments – Maven, Visual Studio, command line, etc
  • 26.
    Support for PSMGuidance • Platform-specific guidance when all the information needed to generate code doesn’t exist in the PIM
  • 27.
  • 28.
    Atlas Maven Configuration •Plugs into the generate sources target
  • 29.
    Case Study 1– Failed Project Rescue • Previous vendor: – Took 3 years to deliver base functionality with unsustainable technical debt – Cost tens of millions of dollars • Using MDD, our team: – Re-implemented base functionality and established new conventions and templates in 4 months – Added several new high-value features – Attained a 70/30 generated/hand-coded ratio – Cost less than one million dollars – Left the client with a model that described the system and a development platform to add new features
  • 30.
    Case Study 2– Bootstrap Development Team • Initial agile seed team formulated conventions and architectural mechanisms during development of initial stories – Majority of technical complexity driven out • Less experienced developers added to multiply development throughput – Conventions and plumbing already established – Most development was “between the braces” – New developers immediately productive • Seed team detached and left less expensive, self- sufficient team in place • Led to multi-million dollar follow-on award to add incremental functionality on product base

Editor's Notes

  • #2 Compliment sessions that talk address figuring out what to build and making sure we built the right thing.
  • #3 “When humans do things that computers can automate, the computers get together and laugh at the humans.”How did we model the business concerns?What decisions did we make about how to implement the system?Code reviews are a reactive way to prevent tech debt.
  • #4 Architectural integrityCode consistencyImplementation patternsMaintainableAdherence to conventions
  • #5 How many people here model?Drive out ambiguity inherent in natural languageAs we will see, models can now be made first-class citizens that are developed just like source code.
  • #7 Object Management GroupOMG MDA states that model is transformed from PIM to PSM and PSM to source code.
  • #10 Complex modeling conventions cause us to focus more on the nuances of the modeling tool instead of focusing on solving the problem.Model the 20% that specifies 80% of the valueUML 2 – Too many modeling conventions and options made it overly complex
  • #11 Traditional Analysis Model artifactYet to find the system whose non-technical aspects can not be described in these terms
  • #13 Pick a development language -> Pick some application framework(s), Decide on your conventions for how to use those frameworks.Template exchange.
  • #15 Example is based on JPA conventions.Templatized PSM.
  • #17 Persistent knowledge transfer mechanism for capturing development decisionsConventions take guesswork out of where to do manual developmentNot locked into specific conventions or languagesApplication frameworks are a start but require manual development on their own
  • #19 Continuously incorporate lessons learned into templates.
  • #20 Product catalog BUFD story @ first bulletBUFD designers tend to fall in love with their designs - not good
  • #21 Practice makes perfect
  • #22 Need way to preserve manual code and maximize automation.
  • #23 Be rigid where we need to enforce key conventions. Allow flexibility where developers need the freedom to implement creative solutions.Generally, flexibility needed for complex business rules and user interface components.
  • #25 Generate Sn web driver finders and Fn fixture test components.
  • #26 UML:Sparx EA, MagicDraw, Visual ParadigmXML
  • #30 30% was mostly business logic and UX related
  • #31 Also established UI / development patterns.