Scaffolding against a database has been done to death. But I wanted to take on some of the harder challenges. How do you act towards relationships? How do you handle one to many, many to one, and many to many relationships? How do you detect these relationships? This is especially important with the ORM features in ColdFusion 9. If we can detect these, and model our CFCs correctly we can save a lot of time by generating these CFCs with relationships included. Then if we scaffold on views that take these relationships into account, we can really turbo charge development.
I also wanted to take on a few key issues like paging and performance. Basically, I wanted paging to be easy. That meant wiring it up from the get go. I wanted performance to be usable. That meant writing common needs like column counts automatically in HQL for optimal performance.
So that’s some of what I’ve set out to do in Apptacular. I have a video below that shows off these features:
- One-to-many relationships
- Many-to-one relationships
- Many-to-many relationships
ColdFusion Builder – Apptacular – Scaffolding from Terry Ryan on Vimeo.
7 thoughts on “Apptacular ColdFusion Builder Extension – Scaffolding”
How easy will it be to a) change the UI and not have it overwritten by the next regeneration? b) define the persistent cfcs and not have it just read from the database?
Great questions. So, I haven’t completely figured that out yet (which is why I haven’t released the code yet.)
As a stop gap measure, I’m enabling application locking. So that you set a config that causes it to warn you that you can’t overwrite. Additionally, the application allows a lot of changing of UI through it. That being said. I have to figure that out.
As for defining CFC’s first, I haven’t enabled it yet, but I can turn off entity creation, and enable dropcreate, and script populate through the generated Application.cfc. That would effectively take care of creating the database, and it could consume all of the info from the database to create the applications.
So it’s still a work in progress. Wait till you see what else it can do.
That is phat.
Very cool! If you want to allow active regeneration of CFC’s, just passively generate subclasses that people can edit and make them extend superclasses that you re-generate every time. It’s the easiest solution to the problem, and the most commonly used.
Active regeneration of layouts is hard, and in the general case probably impossible. There isn’t a strict enough semantic in the generated HTML to be able to do much in the way of intelligent round trip engineering (you can figure out bits and pieces, but not everything). If you were doing it just for yourself, you could come up with a set of constraints you were willing to live with and a specific architecture that would allow for regeneration of as much of the views as possible. In the general case, easiest solution is to move as much of the view functionality (paging links, field displays, validation code, etc) implemented through view helper CFC’s. That way again you can passively gen subclasses for the view helpers should someone want to override the implementation of a method and then actively regenerate the parent view helper classes. Make sure you do things like expose all the metadata through an API, so if you have a fixed number of records per page in your XML, have a getRecordsPerPage() method in the paging.cfc view helper. That way if someone does decide to overload your paging display because they want to change how it works, they can still reuse the XML metadata.
@peter. All very good ideas, but I’m holding off on making the generated application too complex. I’m shooting for something that can whip up a fast application, not necessarily create a proper framework for the future. Also the quicker this works, the more disposable this application can be.
That’s not to say you’re not right. Just that this application is aiming at other audiences.
I would go with the rails way of doing things that you really don’t ever regenerate your views once they are done. Scaffolding is designed as a quick jumping off point and not a complete website out of the box type of thing. I mean you could do that but once a client gets their teeth in it It won’t last anyway.
When generating the application , what permissions does the datasource need on MS SQL Server to make it work. So far the only thing I have been able to make work is the server admin role , I tried some other combinations and it doesnt work.