Site Component Architecture Requirements

Introduction

A design goal for Turbogears 2 is to allow developers to easily install mini-applications (or 'site components') into their own applications. Site components will generally have exposed controller(s) and/or a model that is built upon or enhanced by the end developer. However, they will not generally be as large in scope as a full-blown application. Some examples of a site component might be:

  • rating
  • comments
  • threaded discussion
  • user registration
  • RSS aggregator
  • ?? blog ??
  • ?? identification and authorization (i.e. tg.identity) ??
  • user administration

The purpose of this document is to outline requirements for a site component architecture. Discussion of specific implementation details will be avoided when possible.

Installation

Users should easily be able to add components to an application via a single command. Integration into the main application should require an entry in only one file. For example, the user may enter a command like:

tgmadeuptool install_site_component wonderblog

to install the a component, and then in a controller enter

from somewhere.sitecomponents.wonderblog import WonderBlog
blog = WonderBlog()

Customization

Site components should be easy to change or extend. Easy is a vague term, but in general there should be a well-established, consistent way (across components) for a webapp developer to modify a component for their needs.

This would preclude monkeypatching as primary way to modify an component. Any approach that requires a developer to have a deep understanding of most of the component's inner workings in order to make changes would also be disqualified.

Upgrades

Application developers should be able to easily upgrade site components when bugfixes or enhancements occur to the base component. Upgrades should be able to incorporate any customization that has occurred since the original install.

Model Integration

The user should be able to manage the site component model and database interaction using standard TurboGears tools. Once installed, the user should be able to create (or update) appropriate database tables, use the table admin tools, and track schema migrations.

Intra-Site Component Dependencies

It should be possible for a site component to require that another component is installed in the application. For instance, a blog site component could specify that the threaded discussion component be installed, and then blog component developer could incorporate the threaded discussion component in the blog component.

Similar to the way easy_install works, site components should automatically install dependent components if they do not already exist in the application.

Site Component Conventions

A set of conventions will need to be established for site component developers to follow to ensure a reasonable amount of consistency between components. A subset of conventions that will need to be established are:

  • File layout, including
    • models
    • controllers
    • widgets
    • templates
    • validators
    • configuration
  • CSS classes

  • Template sections / inheritance

2.0/RoughDocs/SiteComponentRequirements (last edited 2008-05-28 11:58:56 by PatrickLewis)