T4 vs CodeDom vs Oslo

In the app lining project I'm working on, I'm trying to decide whether to use Oslo , T4, or CodeDom to generate code. Our goals are to keep dependencies to a minimum and generate code for a domain-driven project from user stories. The first step is to create tests from user stories, but we want domain experts to be able to write their stories on different media (for example, a user application, Word, etc.) and still generate tests from the story.

What I know so far:

  • CodeDom requires .NET, but can only output .NET class files (e.g. .cs, .vb). The difficulty level is quite high.
  • T4 requires CodeDom and VS Standard +. The difficulty level is quite reasonable, especially with the T4 Toolbox .
  • Oslo is very new. I have no idea about dependencies, but I think you should be at least on .NET 3.5. I'm also not sure about the ability to generate code or the difficulty of adding new grammars. However, domain experts could probably easily write user stories in Intellipad. Also not sure about the ease of converting stories in Word to MGrammar.

What are your thoughts, experiences, etc. using any of the above tools. We want to stick with Microsoft or open source tools.

+4
source share
5 answers

Go with the T4 - a simple solution.

  • Oslo is too new, and the tools are too raw to be something like eval-only technology.
  • CodeDOM is powerful if you need to create CLR classes at runtime and are willing to sacrifice a slight modification to your generated output.
  • T4 (with T4 toolkit) is an easy-to-use general-purpose code generation tool. The only difficulty I have encountered so far is the integration of build time.
+9
source

Generally speaking, I see code generation as part of a complete modeling / coding history. It should be accompanied by a general structure in which most of the plumbing is done. In my opinion, it is not practical to create huge classes, whereas a decent structure with well-defined extension points or hooks would be much better to maintain and expand.

You will need to define some formalized language for user stories, be it XML or the Oslo domain language. Oslo will require experts from your domain to study tools in Oslo. You can use Word + XML. Then you define a beautiful template in Word with built-in XML schema, and after writing the story, you can get it from Word in a formalized XML syntax. This XML can, of course, be used to control generators through XSLT or Linq.

CodeDOM is powerful, but rather cumbersome. This IMHO is not an easy-to-use solution, and it does not have real template support.

I have no experience with T4, but its template functions are pre.

The Oslo product is truly brand new, requires .Net 4.0 runtime. This is still only CTP. This is a very powerful environment, although I have some doubts about the history of the database.

Hope this helps.

+3
source

Well, Oslo is not on the list. So far it has no code generation. Therefore, stick to T4.

+1
source

Oslo does not intend to generate code for you. You will need to create a runtime (for example, a C # program) that changes its behavior depending on the data. You can see it as an internet browser.

I don't think Oslo requires .Net 4.0, as Rine mentions. For my internship at Avanade Netherland Im creating MSchema Oslo and MGrammars and the C # 3.5 runtime. Depending on the data data, it will create (not generate) WCF services and run them.

0
source

There are some interesting Oslo applications.

  • "new LDAP" System.Identity, more in PDC session video http://microsoftpdc.com/Sessions/SVC28
  • System.Modelling (I think) Microsoft.UML2, where you can post information about methods, classes, modules, etc. in the repository, analyze and create reports. For example, create a report using the methods added / deleted between 2 buils http://microsoftpdc.com/Sessions/SVR19
  • and of course modeling
0
source

All Articles