SV Surprises With A New .NET Template Engine

by Dave Harms

Published 2009-10-16    Printer-friendly version

Note: The following comments are based on the ClarionLive! webcast of Bob Zaunere's Aussie DevCon presentation. The video and audio link imposes certain limitations; I apologize in advance for any inaccuracies. And my sincere thanks to Geoff Spillane, Arnold Young and John Hickey for making the webcast happen.

In his opening address to the Aussie DevCon, SoftVelocity president Bob Zaunere gave a brief but remarkable presentation on the new Clarion.NET Application Generator.

In short, the new AppGen is a game changer.

Bob described how, in the process of developing the new Clarion.NET AppGen, they went down the path of creating .NET templates using the existing template language. And they found out that although they have a powerful Win32 generator, one thing made that product possible: Clarion's own special set of user interface controls (buttons, list boxes, etc).

In .NET, all that changes. The standard set of controls is much larger, and beyond that is a whole world of third party controls.

The short path was to support the standard controls only, using the existing template engine.

The longer path, the one SV is taking, is a new AppGen built on a template language that is 95% written in C#. These templates are compiled into assemblies, so for the first time Clarion will have compiled templates. And because the templates are .NET code you can debug them with the .NET debugger.

Bob Z pointed out that in any complex system the vast majority of the code is not the user interface. The AppGen he demonstrated wasn't really an AppGen, more a temporary interface (created over the course of a week) on top of the new template engine. On the left side pane was a procedure list. On the right, a set of property grids. It was difficult to see on the web cast, but the point wasn't so much the crude demo interface but the way template prompts were presented in property grids. Each property in a template can have its own property editor, which is a far more configurable system than the current AppGen.

Design goals for the new AppGen include:

  • Version control - the app format is 100% XML and version control friendly (Subversion)
  • You have access to any .NET control/component/service from the template language
  • The ability to attach developer documentation/notes to app and or to individual procedures.
  • Option to generate test cases for aspects of the APP (nUnit)
  • Support fo all Clarion-standard code templates, e.g. call procedures on lookup, instantiate procedure on thread, export to XML
  • Template support for Actions for any .net control including controls from third party vendors ("best efforts")
  • Template language code used in the first release is C# (for ease of debugging), subsequent releases can use any .NET language.
  • Layered interface - you can determine the level of detail you want to work with
  • A much flatter interface

Design goals for the generated code include:

  • All of the business rules and business validation logic will be generated in a domain model tier and not within the UI tier
  • The data access tier uses LINQ via SV's LINQToFileProvider, LINQToSQL, and future LINQ providers
  • The data access tier can use the managed .NET IP driver
  • The LINQToFileProvider incorporates an ABC-style framework - think of it as the best of ABC on top of LINQ
  • LINQ to SQL is itself a lightweight ORM; the templates are being designed so that in the future they could generate using other heavier ORMs such as Entity Framework, NHIbernate, CSLA etc.

The intent is to be able to create code for WinForms, WebForms, CompactForms and web services. Apps generated for each target platform use essentially the same design for the generated code.

Bob asked for requests and ideas for the new AppGen. It was difficult to hear some of the questions over the web link but there was some discussion around dictionaries, including support for multiple dictionaries.

Closing quotes from Bob Z's presentation:

Imagine this - you will generate Clarion styled database applications for every platform supported by .NET without having to be a .NET expert or even writing any .NET code

Each target platform utilizes essentially same design pattern for the generated code (learn one and know them all)

Conclusions and impressions

I was pleasantly surprised (actually gobsmacked is probably a better term) by Bob Z's announcement of a new .NET template engine written in C#.

It may be difficult for most Clarion developers to fully appreciate the significance of this project. One very good way is to spend a whole lot of time writing a template chain in C6 or C7 to generate .NET code, as I've been doing over the last year and a half. You quickly come to appreciate the unique power of the template language, as well as the maddening frustration of not being able to extend the template language itself with .NET code for all those tasks for which the template language, as it is now, is poorly suited. And you wish often for a real template debugger, but you settle for OutputDebugString and DebugView.

In my case I'm writing templates for MVC web apps (in support of, among other things, a new ClarionMag site) and thanks to the nature of the MVC pattern I don't need to rely on the C7 window designer for much more than simply placing controls on a form in a given sequence. Position, appearance is all up to the style sheets. But my, it would be so nice to be able to invoke a different editor here, or a certain bit of .NET code there.

All of that is what the new template engine offers.

I've long argued that the great value of Clarion is not in the Clarion language itself. Oh, the language has its fans, and probably a majority of Clarion developers think much more highly of it than I do.

But let's face facts: although we're a (sort of) loyal and (sometimes) tightly-knit community, we don't have a lot of young blood. If Clarion is to survive, and thrive, it has to grow beyond its current borders. And it will do that by becoming a compelling solution for folks who aren't interested in the Clarion (or Clarion#) language.

The new template engine offers that hope. Until now it's been a daunting task to create an entire application template chain for other languages, in large part due to the limitations of the AppGen and the near impossibility of debugging the templates. It appears likely that SoftVelocity will focus on Clarion# templates, and that's as it should be. Let others bring out the C# and VB.NET templates, or perhaps IronRuby templates - who knows?

The new template engine has the potential to liberate Clarion's code generation technology from its Clarion-centric limitations. And that would be a very good thing, both for the Clarion community and for the wider world of .NET programming. Even if you don't care one iota for .NET, if you rely on Clarion in any form you surely care that SV survives and prospers.

But a note of caution is also in order. Keep in mind that:

  • This is an early demo - it may be some time before a usable version appears.
  • SV has its existing Win32 customer base to tend, and that takes resources too. A solid 7.1 release is essential.
  • The plan for a common architecture for WinForms, WebForms and CompactForms is ambitious.

In other words, the proof is in the pudding. But certainly the direction SV is taking looks most promising, and much better than I had hoped. I believe a fully .NET template language and AppGen is exactly the right approach.


David Harms is an independent software developer and the editor and publisher of Clarion Magazine. He is also co-author with Ross Santos of Developing Clarion for Windows Applications, published by SAMS (1995), and has written or co-written several Java books. David is a member of the American Society of Journalists and Authors (ASJA).

Printer-friendly version

Reader Comments

Posted on Friday, October 16, 2009 by Steven Sitas

Hello David,
well this should have been the "direction from the beginning".
The problem now is that this really is a Huge project and it will probably take sometime - probably over a year from now ..

Good news and bad news at the same time :)



 

Posted on Friday, October 16, 2009 by Dave Harms

I agree - it's a huge project, hence my cautions. But I'm very glad to see this direction.

Dave

 

Posted on Friday, October 16, 2009 by Dave Harms

A clarification about the compiled templates. I believe Z's point was that this adds to the flexibility - it doesn't take anything at all away. Vendors can (and for all we know may have to) still provide the templates as source.

In C7 when you register a template it's stored up in the registry.trf file along with the other templates. No software in the world other than the Clarion AppGen knows what to do with a TRF file.

In the new AppGen, when you register a template (as I understand it) the IDE compiles the template into a DLL. a .NET assembly. Among other things, that means you can debug that template DLL.

It also suggests that you could ship templates as DLLs if you wanted to protect your intellectual property. Whether the developer community will accept that is another point - I suspect that, if possible, it won't be common.

Dave

 

Posted on Saturday, October 17, 2009 by Arnor Baldvinsson

I think compiled templates are a good idea and I would also like to see abilities to use more code, like C++/C#/Whatever in the templates to make them more powerful.  However, it sounds like we are still a year away from a gold releaes of Clarion.net and then another year until the kinks are ironed out - 2011-2012 for Clarion.net probably.  Can we wait that long?

Best regards,

 

Posted on Saturday, October 17, 2009 by Dave Harms

One very important point about Clarion.NET vs C7 is that (assuming 7.1 is as solid as it seems) the rest of the IDE is already usable.

The template engine, I think, should be solid pretty soon, since by its nature it's highly testable.

The dictionary interface to the template engine seems pretty straightforward, and the dictionary editor is basically done.

It'll be interesting to see how they implement the window designer into the new AppGen. I'm guessing that's going to be the biggest task by far.

Dave

 

Posted on Monday, October 19, 2009 by Majodi Ploegmakers

I don't think LINQ to SQL is a good choice. I believe it is discouraged by MS and it only works (again I think) with MSSQL. SQL to Entities would be a better choice or (I'm not an expert) solutions like NHibernate.

Also, wouldn't it be better to pick WPF instead of WinForms?

 

Posted on Monday, October 19, 2009 by Dave Harms

Majodi, I have the same concerns about LINQ to SQL, although Z did point out that SV's new LINQtoFileProvider adds some ABC-like code to help manage relationships etc.

By creating their own LINQ provider they have the opportunity to add support for TPS (although I don't know if that's been explicitly stated - perhaps someone can clarify) as well as keep the code a bit simpler. I've worked with NHibernate, and although I like it a lot and am using it for the new ClarionMag site, it does add a bit more complexity in terms of the classes you need to generate (entities, mapping classes etc.).

I do think that down the road there absolutely will have to be C# templates that employ NHibernate and/or EF. NH is more mature, not only because it's been around longer but because it's a port of the long-standing Java project. EF 4 (which is really version 2) looks to be much more usable than EF 1, but it's still in beta and doesn't have support for as many SQL databases as NH. Also if you're not on MS SQL you have to worry a bit about being a second class citizen in EF. But it'll be a strong contender I've no doubt.

As for WPF, I think SV is largely relying on the SD folks. There was a WPF designer in SD 3.1, but it was withdrawn after Microsoft announced they would be adding a xaml parser to .NET 4.0. A WPF designer is in the works for SD 4.0, and at some point presumably SV would be in a position to look at implementing that for the new AppGen.

Dave

To add a comment to this article you must log in.

 
 

Search

 

Advanced Search
Topical Index

Related Articles

Subscribe to
ClarionMag

One year: $169

(includes all back issues since '99)

Renewals from $119

Two years: $269

Renewals from $219

More Info

Subscribe Now!

ClarionMag Blog

RSS Feeds

Updates via Email

Enter your Email


Powered by FeedBlitz

Quick Links