Monday, October 31, 2005

Rapidly Developing Rapid Application Development Frameworks

No sooner had my Turbogears post hit the web than I found that the project's maintainer, Kevin, laid out some intentions as they march towards version 1.0. Specifically, they're going to be implementing some of the features I mentioned (including a CRUD framework for form generation). In addition, the CatWalk model browser was added to the project. Originally written with the TurboGears stack, CatWalk was integrated as part of the project itself. Who knew!? CatWalk makes a great addition to an already great web development stack.

In addition to identity management and CRUD, the project definitely has some high hopes for their 1.0 release; and given the current pace of development, I think they're going to hit their goals right on the mark. In addition, the sub-projects that comprise TurboGears are under active development as well (CherryPy just had their 2.1 release, and Mochikit hit version 1.0). This, among other factors, makes TurboGears a definite project to watch. It's user-base is growing leaps and bounds, and I think there is definitely a lot of potential for the project as a whole. If this level of activity can be maintained throughout the development of the project, I think we'll definitely see a whole mess of features integrated and added as the project progresses through it's infancy into "mature" stages.

Monday, October 17, 2005

Gun's Initial Take on TurboGears

I recently discovered TurboGears: Front-to-Back Web Development thanks to a post on Slashdot. I downloaded and installed the software and perused the available documentation. I must say that I am thoroughly impressed the with technology. The Slashdot article called it "Python on Rails", which is a reference to Ruby on Rails (RoR). The RoR stack of applications is a (very) Rapid Application Development environment which can be used to very quickly whip out web-based, database-driven applications. While I think TurboGears has a lot of potential, I don't think it merits the "Python on Rails" badge just yet.

Disclaimer: I'm a huge Python fan and I've never used RoR in a production environment. In fact, I've only fiddled with it to see how it works. Don't think I'm bashing TurboGears here. I'm just trying to think of how we can make it better.

Automatic form creation

In the RoR environment, when I add a field (or column... whatever) to a database table, the RoR software notices the new data and updates the MVC to take into account that there is new data present which may or may not need to be modified in the future. The forms are updated to include the new field as are the methods necessary for the controller to update/add/delete information to the new field whenever working with records in the table. Personally, I think this is a great feature. The fact that all of the forms are automagically generated for you based on your data is just fantastic.

Imagine deciding to dump an archaic PHP interface and roll out a new front end using all of the latest and greatest technologies. I want to be able to say something along the lines of, "here... this is my Postgres database over here with all of its views, triggers, foreign keys, transactions, sequences, etc. etc. etc." and have a basic, functional web front end auto-created for me. Not just any web frontend, but one that I can modify, build on, add to, etc. etc. RoR even does this without any code. To generate the actual code to do it, you use some sort of "scaffold" function to see what is really going on behind the scenes.

I think TurboGears, using the SQLObject code to pull metadata from the database, would greatly benefit from having this sort of functionality. Currently, the preffered method is to define the data model in SQLObject syntax and run "tg-admin sql create" on the command line to create the schema in the database. In a perfect world, I want to be able to do it any of the following ways:
  1. Create the database using SQL and have TurboGears read it
  2. Create the schema using SQLObject syntax and have it populate my database for me
  3. Create the database using some nifty [web-based] modelling tool and have it update both the databse AND the model code.
This is obviously still a ways off, but I'm thinking I may write some code in a TurboGears app to see what can be accomplished. Imagine that... a TurboGears app used to create TurboGears apps.

Incomplete Package

I'm somewhat of a dabbler. This means I don't really have time to sit down and go through each technology in detail to learn every nuance. My job function requires me to be jack of all trades and master of a handful.

I use primarily Open Source Software on my development PC, but I use it in a Windows environment and will continue to do so (dual boot to the rescue!) thanks to Flash utilities I am required to run from time to time. While the ez_setup.py script did most of the heavy lifting for me to get TurboGears up and running, it left out a few key parts. Namely, the database modules. I had to download the database frontends for sqlite and MySQL. When I finally downloaded the sqlite frontend, I realized that the sqlite databases aren't automatically created if they don't exist. I also realized that my version of sqlite (2.x.x) was incompatible with the version installed from PyPI (3.x.x).

Database schema alterations don't exactly go with the flow when attempted upon an sqlite database, so I decided to install MySQL so I could test more features related to my project mentioned above (a web-based frontend for building TurboGears apps). Disaster! The mysql-python module won't install cleanly on Windows with the ez_setup.py.

See... Windows users are somewhat lazy. They don't like to get under the hood. They just want to double click setup.exe (or .msi) and click "I agree->Next->Next->Next->Finish" and be ready to roll. Imagine if this were accomplished with a TurboGears installer. The package could include everything needed: the base packages, the database modules, and even the sqlite.exe program for initiating and manipulating sqlite databases on the command line.

Where to from here?

I understand that TurboGears isn't even to version 1.0 yet. I also understand that as much as I wish, I probably won't see the two items mentioned here "magically" appear in 1.0. Nevertheless, I think that such goals are easily attainable for future versions if properly planned. I have to get my TurboGears installation sane before I can try some of it on my own. In the meantime, I guess I'll just keep up to date on the docs and try to soak up whatever information I can.