Clarion# web apps with AppGen? Yes, just not the AppGen you think (at least not yet)

Within the next couple of days I expect to post ClarionMag's first ever screencast. The subject is a small demo app showing how to do AppGen-based Clarion# web development right now, even without a Clarion# AppGen. The secret: a custom template chain we've specifically designed to create MVC web applications using Castle Monorail and NHibernate. What's MVC? It's an increasingly popular way to write testable, maintainable web applications. Even Microsoft has jumped on the MVC bandwagon (although their code is still pretty green).

I'm particularly excited about this template chain as it provides us with the technology we need to begin porting the ClarionMag web application from its current Java code base to Clarion#.

Don't let the small number of pages in this web application fool you - there's a lot packed into this little app. The home page isn't particularly complex, however; it simply gives you an overview of the application's capabilities.

Most of the goodies are in the browse page. There are two versions of this browse. The HTML version features column sorting, filtering (many kinds of filters are possible, although only insensitive LIKE expressions are shown here), and fast server-side paging which allows you to work with large result sets. The browse state is persistent; navigate to another page, come back to the page, and you see the same data as last time.

But HTML browses aren't that pretty, and getting the next set of data requires a distracting page refresh. So there's a sneak peek at an AJAX version of the browse created with the ExtJS toolkit. This browse isn't fully functional yet, nor is it integrated with the templates, but it does demonstrate the use of JSON requests to load a browse without refreshing the page. And it looks a lot nicer than an HTML browse, and behaves the way a browse should. We'll be doing more work with ExtJS components in the future.

There isn't any security on the browse, but there is on the form. It's a simple requirement - you only need to be logged in. So if you attempt to edit, insert or delete a record (from the HTML browse) and you're not yet logged in, you'll see a login page.

You can use the guest login or register your own user id. If you have Javascript enabled you'll see validation messages appear below incorrectly filled fields. (If Javascript is disabled, server-side validation still ensures correct data.)

Once you're logged in you're returned to the form where you can complete the desired changes.

There are several important caveats to this template chain.

First, it's most definitely alpha code, and there's a lot of work to be done.

Second, since the generated code uses the NHibernate ORM to talk to the database you're limited to supported SQL databases. Right now that list includes:

  • Microsoft SQL Server 2005/2000
  • Oracle
  • Microsoft Access
  • Firebird
  • PostgreSQL
  • DB2 UDB
  • MySQL
  • SQLite

No TPS files there, and wouldn't hold my breath waiting for a TopSpeed NHibernate driver.

(Actually, you can still access TPS or other Clarion# drivers if you wish, you just can't take advantage of the automated validation and data binding, both of which are enormously useful on forms.)

Third, this template chain is not ABC or legacy Clarion compatible. You cannot use it to convert an existing application; you can only use it to create a new application. MVC web development is significantly different from Clarion desktop development, and while it may be possible to write these templates as an add-on, it really isn't practical.

I hope you'll find the upcoming screencast and an accompanying series of articles interesting and useful. Web development is a different beast from desktop development, and many of the issues I'll cover apply to non-MVC web development as well.

And even if you're not interested in doing your own web development you will benefit as a ClarionMag user, as this template chain forms the foundation for the next version of the Clarion Magazine web site....

Posted: March 12 2009

Clarion Roadmap

Try the roadmap (beta)

Search ClarionMag

 

Advanced search

From the archives

A Callback Technique for Capesoft's FileManager2

12/21/2006 12:00:00 AM

CapeSoft's FileManager2, and its more recent incarnation FileManager3, are amazing products: they completely automate the process of upgrading client databases, whether local or across a network, and make it easy to do file maintenance. Randy Rogers shows how to add a callback procedure to FM2 to provide user feedback during startup.