tangible T4 Editor Blog

News, Tip and Tricks from the tangible T4 Editor team.

  • Home
  • Blog
  • Blog Series: Model Driven Development with T4 templates

Blog Series: Model Driven Development with T4 templates

This blog series deals with the idea of Model Driven Development. In five parts we’re going to cover what Model Driven Development is and what tangible engineering offers to support this kind of software development process. We also walk through a scenario showing how to use our products.

 

In order to reconstruct all steps presented in this blog series, you need the following:

This first part of the blog series talks about the principles behind the Model Driven Development and tangibles contribution to implement this development process. Finally we give an overview how this blog series continues.

 

What is Model Driven Development?
Tangible Engineering’s support for MDD
Overview of MDD Blog Series

Disclaimer

 

What is Model Driven Development

Model Driven Development (MDD) is an approach to design and develop software based on abstract but human-elaborated models using domain specific knowledge. These models usually are represented by diagrams like Component Diagrams, Distribution Diagrams, Activity Diagrams and/or Class Diagrams. While designing the resulting software, architects use these diagrams to communicate ideas and requirements between the different stakeholders (End Users, Decision Makers, Software Developers, …).

Thus MDD is considered useful when the created domain specific models make sense to the domain users as well as serve as a basis for implementing the system. The actual implementation can either be done manually or assisted by automatic code generation, e.g. in a rapid prototype scenario.

 

From Platform Independent Models to Platform Dependent Models

In the implementation process the domain specific models are also referred to as “platform independent models”, since their information is valid no matter what platform or programming language will be used to create the software. Either the manual code writing or a code generation process transform this independent model into a platform dependent model e.g. for a specific operation system.

The advantage of automated code generation is, that changes need to be applied only to the platform independent (domain specific) model. All other artifacts can be automatically regenerated and then contain the desired changes.

 

Tangible Engineering’s support for MDD

The product portfolio of tangible engineering GmbH comprises several components to be used in a Model Driven Development process:

 

  • Tangible Modeling Tools
    The tangible Modeling Tools augment Visual Studio and add a designer for Activity Diagrams, Class Diagrams, Component Diagrams, Persistence Diagrams, State Diagrams and UseCase Diagrams. In contrast to other UML diagram designers, those of the tangible Modeling Tools can be extended to store additional, user defined information.
    The key feature of tangible Modeling Tools is their integration into T4 Templates, to make it very easy to build domain specific models from any modeling diagram using T4.

    Persistence Diagram of the Tangible Modeling Tools
  • Tangible T4 Editor
    Visual Studio ships with full T4 templating functionality but lacks any editor experience. The tangible T4 Editor adds a new Editor extension to Visual Studio with known Visual Studio experience: syntax highlighting, IntelliSense, auto completion,  snippet support, … (view full feature list here).
    This makes it easy for everyone to edit existing T4 templates or create custom templates for code generation purposes. It’s not necessarily .NET code that can be generated – any output format is possible: HTML, XML, SQL, php – just to mention a few.

    tangible T4 Editor with syntax highlighting and intellisense
  • Tangible T4 Template Gallery
    In order to get an easy start into T4 templating the tangible T4 Editor hosts a free T4 template gallery. You can find templates there that explain the functionalities of the T4 engine as well as supportive template parts you can reference inside your templates as well as fully functional and ready-to-use templates solving common problems.
    All templates in the gallery are free to use in your own projects. Maybe you’re going to share some of your templates in our gallery?
    free tangible T4 template gallery

Overview of MDD Blog Series

Although – as previously mentioned – Model Driven Development usually uses several different models interacting and completing each other, we will focus in this series on domain specific Persistence Models and create a persistence layer, a data access layer and a basic user interface from those models:

 

Part 1: Model Driven Development and Series Overview

Part 2: Create a Persistence Model using Tangible Modeling Tools

Part 3: Generating Domain Specific data objects using T4 and EntityFramework 5 CodeFirst

Part 4: Data Persistence and Versioning

Part 5: Generate a Basic UI using T4 and Windows Presentation Foundation

 

Series Meta-Model

Before diving in the Model Driven Development series, we should already start thinking in models. The following graphic shows a model of what we’ll walk through in the four upcoming parts:

 

image

 

We’re going to put some domain specific knowledge of an imaginary customer and create a Persitence Model Diagram (.tasl-File) from it. A T4 template will use this Model file to generate ready-to-use C# EntityFramework Data Access Objects which will allow us to store Data in a relational database.

Another T4 template will transform the Knowledge inside the Persistence Model to generate a Basic User Interface accessing the previously generated Data Objects.

 

In order to create a fully functional software we would need to manually extend the generated code artifacts by a business logic layer and customize the basic user interface. To achieve this we could again use models from the tangible Modeling Tools but this is not covered in this series.

 

Disclaimer

The artifacts being developed or presented during this series do not claim to be omnipotent. They are merely a showcase of basics that can be achieved using tangible engineering products. You are free to use to improve the results of this series to match your needs and use them in your solutions.

If you need further assistance or you are looking for a partner in MDD, please contact us at info@tangible-engineering.com.

Twitter Updates