I've already admitted to being a lazy programmer, because I use a code generator application. I've already said I am looking for alternatives, looking at open source PHP frameworks like Kohana. But I don't wish to give up the time savings from the code generator.
I wish to be able to create my application with both HTML frontend as well as an API that can be used by AJAX methods as well as external appliacations. I've long ago dissed the SOAP methodology in favor of REST. I'm also giving the finger to the typical ORM solutions. This isn't leaving me with a lot of options.
My current code generator assumes you are starting with an already defined database. This is good from the perspective that the database should be designed first by someone who knows what they are doing, and not by a designer or even a mere progammer.
The problem with every framework or code generation system I have seen is that they start from one point and expand from there. This could be to start from the database and then extrapolate out from that to generate the code and the presentation. Or they might start from the code and then generate a schema to map code data/objects to.
The purpose of all this of course is to reduce the tedium of coding:
Database: CRUD operations, validating and filtering data going in/out of the db, help constructing more complex SQL queries.
Code: validating and filtering external data from forms, external API's, etc, coordinating among many different data sources and assembling them together for output.
Presentation: formatting into HTML, or JSON, or XML, or whatever; consistent look and feel forms connected to the code, validating and filtering data.
Instead of one of these tiers driving the others, it should be instead possible to have them all done independently with some easy streamlined method for connecting them together. This way, the DBA can design his lovely normalized database schema while the designers can create a slick, end-user intuitive GUI. And the poor programmer caught in the middle doesn't have to deal with the impossible disconnect between the presentation and the data abstraction, he can just connect it all up easily and write his business logic to make it all work.
2 comments:
You seem to have the some of the same ideas as me. I decided to make my own PHP framework, using CodeIgniter's database library, django style URLs, built in but optional auth, and a mega hack so you can do things like $user = users::getid(1). It also has a code generator which is easiest to explain with a screenshot: http://img382.imageshack.us/img382/570/genlw2.gif
It does a hell of a lot more requests/sec than any other PHP framework too.
Long weekend.
Anyway, I've been looking at the Kohana framework which is a fork of Codeigniter.
I'm not really getting a feel for your concept of code generation from that image.
But I am always interested in alternatives!
Right now I am considering that really what I need is three separate tools that can generate code independantly, but are designed to interface with each other. Maybe a fourth tool would be used to stitch them together.
Post a Comment