Scaffold (programming)
This page or section may contain link spam masquerading as content. (August 2010) |
Scaffolding is a meta-programming method of building database-backed software applications. It is a technique supported by some model-view-controller frameworks, in which the programmer may write a specification that describes how the application database may be used. The compiler uses this specification to generate code that the application can use to create, read, update and delete database entries, effectively treating the template as a "scaffold" on which to build a more powerful application.
Scaffolding is an evolution of database code generators from earlier development environments, such as Oracle's CASE Generator, and many other 4GL client-server software development products.
Scaffolding was popularized by the Ruby on Rails framework. It has been adapted to other software frameworks, including Django, Monorail (.Net), KumbiaPHP, CodeIgniter, Symfony, Yii, CakePHP, Model-Glue, Grails, Catalyst, Seam Framework, ASP.NET Dynamic Data and ASP.NET MVC Framework's Metadata Template Helpers.
Scaffolding in Ruby on Rails
There are two ways to produce a scaffold in Ruby on Rails: dynamic scaffolding and scaffold generation.
Dynamic scaffolding
When the line scaffold :model_name
is added to a controller, Rails will automatically generate all of the appropriate data interfaces at run time. Since the API is generated on the fly, the programmer cannot easily modify the interfaces generated this way. Such a simple scaffold is often used for prototyping applications and entering test data into a database.
Note, as of Rails2.0, dynamic scaffolding is no longer stored
Scaffold generation
The programmer may also run an external command to generate Ruby code for the scaffold in advance: rails generate scaffold model_name
. The generate
script will produce files of Ruby code that the application can use to interact with the database. It is somewhat less convenient than dynamic scaffolding, but gives the programmer the flexibility of modifying and customizing the generated APIs.
See also
External links
- Scaffolding Method Reference (From rubyonrails.org) dead link
- KumbiaPHP Framework
- The CakePHP Framework
- The symfony Framework
- Akelos PHP Framework
- The Model-Glue Framework
- PHP Scaffold Class
- Simple CRUD page maker for PHP/MySQL
- The Gaia Flash Framework
- Castle Monorail
- Asp.Net Dynamic Data
- SIDE-Labs, scaffolding for Alfresco