SV Surprises With A New .NET Template Engine
Posted October 16 2009
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.
Article comments
Post a comment
You must be logged on to post comments.
Talk To Us!
Search ClarionMag
From the archives
David Bayliss On The ErrorClass
2/22/1999 12:00:00 PM
David Bayliss begins his comprehensive series on the inner workings of ABC with a discussion of ErrorClass, one of the most fundamental and basic ABC classes.

by Steven Sitas on October 16 2009 (comment link)
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 :)
by Dave Harms on October 16 2009 (comment link)
Dave
by Dave Harms on October 16 2009 (comment link)
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
by Arnor Baldvinsson on October 17 2009 (comment link)
Best regards,
by Dave Harms on October 17 2009 (comment link)
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
by Majodi Ploegmakers on October 19 2009 (comment link)
Also, wouldn't it be better to pick WPF instead of WinForms?
by Dave Harms on October 19 2009 (comment link)
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