Posts categorized “Architecture”.

Forward engineering with MDD: A proof of concept

Hello everybody!

I want to share with you a set of videos to show what I understand when talking about Forward Engineering applied to MDD.

First of all, a legal disclaimer: my apologies for the quality of the videos and for my rusty English: I am starting to play with video editing tools and recording software so I expect to improve my recording and editing skills on the way. Anyway, I found (I hope) they have enough quality to explain the main ideas. So seeing it is totally up to you! You have been warned!  🙂

Also note: see the videos in High Quality mode (HQ) in Youtube. Otherwise, details of the samples probably will not be visible.

In a previous post I introduced a sample of the code that can be generated from a very basic conceptual model. I have created three videos to show you the main steps involved.

  1. Modeling (Video 1/3). The first video uses a minimalistic class model created inside Visual Studio 2005 with Microsoft DSL Tools. The sample creates a basic blog structure in less than 5 minutes. Note that in the specification there are no technological choices (neither the types are bind to a concrete language representation).
  2. Code Generation (Video 2/3). A quick step: Selecting a code generation (selecting a target architecture), fixing the design choices offered by the code generation and pressing the red button: Generate! A full .NET Solution is generated in less than 5 seconds ready to compile.
  3. A quick code review of the generated code (Video 3/3). Finally, I am sure you have curiosity to take a look to the output code, don’t you? This third video shows a walkthrough to show:
    • DB Scripts (table creation, foreign keys, drop scripts)
    • Database creation
    • Logic layer: POCOs (Plain Old CLR objects), NHibernate mappings and a Business Service Layer with fully functional CRUD operations.

So this is it. It is a proof of concept of how fast and direct MDD tools can be starting from a minimalistic model.

When talking about using or buying modeling & code generation products my advice is:

  • Don’t use models just for documentation. They will be outdated soon or later. On the contrary, a living (generating) model is always in sync with its target application.
  • Don’t resign yourself to just using code generation of skeletons. As you just have seen the current technology allows you to generate much more.
  • Don’t be content if anyone try to sell you a model too close or tied in any way to a given target language. Today we have just generated C#, but tomorrow may be we prefer Ruby? Python?
  • Don’t resign yourself to use a tool married with a specific database. You know, technology changes faster that we usually expect.

SOA and MDD with Oslo

In the issue #21 of the Microsoft Architecture Journal, Cesar de la Torre talks about implementing SOA using an MDD aproach supported with Oslo: Model Driven SOA with Oslo.

In the economic crisis scenario, some voices argues about the death of SOA (more, more and more) just even before few organizations has already started to adopt it.

However, the SOA approach has valuable principles for Enterprise Software organization for the long term maintenance, integration and minimizing the TCO.

Johan den Haan has a nice post about it: SOA is dead; long live Model-Driven SOA.

As a supporter of MDD, I agree with Cesar and Johan, MD SOA could be a way to deliver the good principles behing SOA.

SOA is always a tough topic to explain for first time visitors. To help to introduce it I will link a superb presentation about it: Meet mike… (credits for Eduard Hildebrandt).

MDD with Oslo

MDD with Oslo

On the other hand, as Cesar pointed, Microsoft Oslo project has/had (after the rebranding) potential to be a good platform for domain modelling with textual DSL (MGrammar) and visual DSL (Quadrant).

As commented in the previous posts, it’s a pity that for the moment modeling efforts at Microsoft has been focused too much into one particular tree “the SQL Server scope” and loose the full forest vision.

Choosing a Template Engine for code generation

Selecting a good Template Engine is an important issue when dealing with code generation.

Since 1998 I’ve been testing almost lots of them and forming an opinion about it at the same time the technology evolved. Been at CG2009 and attending the session of Kathleen Dollard on Template Specialization brought to my mind all the times I wasn’t satisfied with my current template engine and changed to try for a new one.

Doing commercial code generators, I’ve been tested lost of techniques: direct string concatenation, XSLT, direct code generation (or what Kathleen calls brute force code gen), ASP, JSP based approaches, developing custom template engines (two of them), taking a look to Code Smith, T4 and others, using NVelocity and finally arriving till StringTemplate (for the moment).
More… »

Scaling MDD for production

This was my contribution for the Code Generation 2009 conference.

The central idea of my speech was devoted to achieve scalability in MDD tools & methods for industrial application of the MDD technology.

I was so glad to see that Markus Völter and Steven Kelly also just 30 minutes before my talk, were addressing the same key issues in their inspiring keynote: scalability, partitioning, modularization of DSL. This fact reinforce me in the idea that we are really growing as a community (CG) with common problems and aligned in the solutions improving the tools & techniques more and more every year.

Scaling MDD for production: enabling SoC at model time

There was also time for an small but complete live demo of a small tool socDriven running and demonstrating the concepts explained. The tool was implementing a compiler and merger for a small textual DSL. The DSL was parsed using the OSLO MGrammar to create the AST. A merged engine in a second phase glued the partial specifications producing as output:

  • the same specs merged in a unique file,
  • the same spec ready to be open with a graphical editor with DSL Tools,
  • a full code generation solution on VS2008 containing:
    • scripts for SQL Server
    • a logic layers with POCOs & full NHibernate mappings
    • a default CRUD service definition,
    • a default Web Service definition,
    • and a Windows Form UI ready to query and execute CRUD operations.

After the generation of the solution, it can be opened with VS, create the DB launching the scripts provided and pressing just F5 for building and running it all! == (a.k.a the utopia of 0 custom code) };-)

Please, feel free to add your comments!