Monday, August 13, 2007

The Big Picture


This diagram does not as bad as it may seem. It shows core parts that make up a TurboGears application.

TurboGears followed MVC (Model, View, Controller) design pattern, which seperate the web application design into three different roles, to build the default quickstart project.

A great deal of it comes from TurboGears itself. Your application consists of the parts in the light purple boxes. Let's look at each part:

Model

  • Your model objects represent the data that your application is working with.

Controller

  • The controller's responsibility is to map URLs to actual functionalities.
  • Those functionalities are able to call the model's API to retrieve and/or update the data in the database or other object.
  • Controller is able to choose some sort of templating engine to provide the user's view of the data.

View

  • In TurboGears, your view is in templates that present the information that is provided by the controller.

The controller is the basis of the framework, and that the view and the model can be created in other ways. It means TurboGears also offer you the flexibility to 'not use the MVC' as well.

Thus you can port existing web software into TG without an immediate complete revision to all of the code.

You have these three areas to populate with code in order to make your application. TurboGears provides help at each point.

  • CherryPy makes it easy for your controller to get information from the web and string together all of the pieces that comprise your website.
  • SQLObject makes it easy to define and work with your model.
  • Kid makes it easy to generate good HTML for the browser.
  • MochiKit makes it easy to implement complex in-the-browser behavior and can even be used to format output in AJAX requests that skip over Kid.
source from: http://docs.turbogears.org/1.0/GettingStarted/BigPicture

No comments: