CodeSmith, .netTiers, code generation, etc
This is a quick request for a show of hands as to how many of you have done any work with code generation for clients to MV – or how many of you may be interested in rapid code generation for new MV user interfaces.
I’ve been using CodeSmith for generating code according to the .netTiers architecture, which structures code according to well-defined standards and patterns. The result is massive amounts of .NET code that builds immediately and can be used for web projects and thick clients. In other words, point CodeSmith to an MV account (D3, jBASE, QM, Universe, Unidata, etc) and it will generate complex classes for every file, with separation of Business Logic Layer from Data Access Layer, full DataSource objects, etc.
The task is only partially complete however. The .netTiers templates create excellent code for CRUD operations (Create, Retrieve, Update, Delete) on a relational database. While the code is fairly complete to extract schema data from the MV source, the post-generation, run-time data interface needs a lot of work – SQL queries against MV are mostly useless, certainly not cross-platform portable. For anyone who wants to reproduce their MV structures in SQL Server or Oracle, the effort can stop there, but for the rest of us who actually want to access the MV environment at run-time, I still have some code to write. That involves replacing functions like Update() and GetRecord(), which right now do SQL queries to return DataRows, with mv.NET code that does what we normally do with MV files, which is Open, Read, and Write with dynamic arrays. Also, of course stored procedures can be trashed entirely but must be replaced with MV BASIC equivalents that are generated and pushed back out to the MV environment, isolated from existing app code of course, but integrating with it as required.
Another effort "down the line" will be to structure basic File classes into business rules – limited purpose components that don’t read all possible data if they only need to operate on certain fields. I already have CodeSmith reading "Views" which I’ve created of some files, but nothing near a real business object yet.
My goal is to create a tool that I can use to point at an existing database and auto-generate a complete rich UI for web or desktop. This sort of magic is already possible for relational environments so I want it for MV. Of course there is still a lot of work to do after the initial effort, but a tool like this will shortcut new development efforts by several of months.
I suspect a number of people will be interested in this, so brief comments are welcome here, but please post inquiries and discussions in the forum here. (Or if you’re not registered, just e-mail me.)
[EDIT: See other blog entry on this topic.]