Turbogears and Seam

I want to shake Kevin Dangoor's hand. I probably would like to meet Gavin King someday, because he seems like a smart fellow too, but Kevin Dangoor is a genius. We've been struggling with JBoss and Seam in our group for over six weeks now, and so far have produced an overengineered, complex, brittle application that works on only half of our boxes. To be honest, development has picked up quickly when more energy is applied to it; however, if you look at it mathematically, I think it's a useless point. Out of curiosity and frustration, Robert and I hammered out a simplified version of the app, complete with CRUD pages in two nights, using Turbogears and tgcrud. It's far from complete, but it didn't take that long. Fleshing out the data model to include all the information should be relatively easy compared. Generating the crud pages again will take about 20-40 minutes depending on how complex it gets. But if seven people were to work on adding in the other stuff, in an organized fashion, I think we could have this app done in about two weeks time.

What I really don't understand is if Seam has all these goodies, (and the sheer number alone really impresses me, coming from a Struts background), why does it take longer to develop for it? Well, I probably do. Our group certainly isn't within the statistic norm. For most of us, this is the first time doing an enterprise application. When the code base expands, seam should keep the maintenance required fairly level, and the level of difficulty in adding more content should also be low. In contrast Turbogears is missing alot of these features. Yet setting up what we needed on a basic level was Very Very Fast (TM).

Either way, here is what we've done in the past three days.
  • We discussed a simplified version of the data model, so that we could do some RAD, rather than making sure stupid stuff, like validators for each and every piece of data were correct and functioning.
  • That was implemented in almost no time at all in SQLObject
  • Bobby pointed me to tgcrud, which I spent an evening going through, and setting up. It's buggy, it's not polished, but I got some useful starting pages out of it.
  • I put a few touches on them, and we have some barebones crud pages that will let us populate the database theoretically.
  • Using one of those CRUD pagesets as an example, I've been working on a CRUD Widget, that can be embedded anywhere almost pythonically. I'm nearly done.
The CRUD Widget is my little pet :). I was looking through Seam's and other's ideas about CRUD and realized that they leave a few questions about relationships (such as the whole OneToOne and OneToMany thing) unanswered. Let's say I'm entering information about Employees and Divisions. An employee is in only one division. The relationship is fairly obvious. So let's just say I'm going through a list of things I have to entire in, name, address, phone, payroll information, hair colour, astrological sign, favorite food and colour, most recent dream, and shoe size. Oh yeah, and Division. I go through all the rest, with little trouble, but when I get to division, i realize that he is the first person to work for the newly opened Pizza Eating division (which every company should have one.) So I click "select division, then new division" and a popup shows up that gives me a form to create a new division. I click save, get a flashed message "Division Created, word domination options available", and then go along my merry evil genious way. Having a crud widget that can be fetched from the server to show up in AJAX, or a popup or a whatever (ever hear of a flooxamble? I hear they are a popular input method of choice on gthBoxl these days).

To put this in MVC perspective, there is the model, that is the database object, in a nutshell, with metadata such as validation. There is the view, that shows how to display a view to do whatever to said model, and the controller which can push data changes from the view back to the model. It's a mini MVC component, that can be integrated almost wholesale into the app. The cool thing is that you will be able to put controller code, via python that will know how to get information from the view to the model. Likewise, there will be a small snippet of code that has to almost cut and paste into the KID file, for parsing. Finally, I want to make this generic, and templatified (I made that word up ^_^) so that I can make this simple to do via tgcrud.

What's left to do? Make complicated pages with more unique ways of looking at the data. Such as having a user login and only see information pertinent to their group, rather than just a generic list of events. There are a number of things that Seam does quite neatly to make this easier to develop. TG doesn't have them. It'll be interesting to see how far I can go in my spare time to make this work.

Happy 4th, aka declaration of presumed (falsely) right to bully the other nations of the world day!

0 flames: