| #summary Model-View-Controller pattern | |
| #labels Phase-Design,Deprecated,Importance-Overview | |
| [MelangeIntro Melange] follows | |
| [http://en.wikipedia.org/wiki/Model-view-controller Model-View-Controller] patterns | |
| at multiple levels. The [SoCOverview SoC framework] provides a set of | |
| common [ModelsOverview Model], [ViewsOverview Views], and | |
| [ControllersOverview generic Controllers] to be used by each Melange | |
| web application. Each of those applications is then similarly arranged | |
| in a Model-View-Controller pattern. | |
| == Models == | |
| Entities of each [ModelsOverview Model] are stored in the | |
| [http://code.google.com/appengine/docs/datastore/ Google App Engine Datastore]. All | |
| data for a given instance of a particular Program is stored in Model entities | |
| in the Datastore. The SoC framework Models are designed so that they can be | |
| used in a variety of Program formats, including both [GSoC GSoC] and | |
| [GHOP GHOP]. Other Melange Models not in the SoC framework are specific to | |
| a particular Program. | |
| The Models are also designed so that, while entities are specific to a given | |
| year of a particular Program, entities can be _imported_ from one Program | |
| instance to another. For example, a [PersonModel Person] need not re-enter | |
| all of their personal information to participate in another, future Program, | |
| even if their participation is going to be in a different role (an | |
| [OrganizationModel Organization] [ReviewerModel Reviewer], say, rather than | |
| a [ContributorModel Contributor]). | |
| == Views == | |
| Model entities are displayed and modified via a variety of | |
| [ViewsOverview Views]. Some views simply display entities or lists of | |
| entities, while other views are forms for creating and altering entities. | |
| The Melange views are implemented using Django templates and forms. | |
| Many of these views are shared and re-used between different Programs and | |
| their Program-specific [ControllersOverview Controllers]. | |
| === Import and Export Views === | |
| In addition to the HTML page views, other special "Views" are used to provide | |
| read-write [GDataOverview GData APIs] and read-only [FeedsOverview Atom feeds] | |
| and CSV file exports. These GData APIs, Atom feeds, and CSV files provide | |
| import and export capabilities for Program entities. | |
| The Melange GData APIs will also make it possible to implement alternative | |
| front-ends capable of viewing and manipulating, say, one Organization's data. | |
| Such a front-end could be implemented in any programming language that can be | |
| used to implement a GData client. Such Organization-specific front-ends could, | |
| for example, be embedded in the Organization's web site. These GData APIs | |
| could also be used to create widgets such as | |
| [http://code.google.com/apis/gadgets/ Google Gadgets] that monitor or alter small | |
| aspects of a Program. | |
| Atom feeds make it possible to monitor activity during the course of a | |
| Program *without* resorting to email, using a _pull_ approach instead of the | |
| existing email _push_ method. | |
| == Controllers == | |
| Each separate program (e.g. [GSoC GSoC] and [GHOP GHOP]) implements its own | |
| [ControllersOverview Controller] containing the "business logic" of the | |
| program (though in the case of these two examples, much of the code in the | |
| two Controllers is expected to be shared). It will be possible to support | |
| Program formats that have not yet been conceived by adding new Controller | |
| modules to the framework. Since Melange is being released under an Open Source | |
| license, new Sponsor organizations could implement their own custom Program | |
| while reusing much of the SoC framework code. | |
| === Security and Roles === | |
| The Controllers make use of [UserRoles user role] [RoleModels Model entities] | |
| to decide what other Program entities are viewable or modifiable by a | |
| particular | |
| [http://www.google.com/support/accounts/ Google Accounts-authenticated] | |
| [UserModel User]. | |
| [ViewsOverview Views] will submit the Model entity and the | |
| [UserRoles specific role] to an "authorization" method in the Controller. | |
| This method will indicate what privileges (read-only, read-write, | |
| not-authorized, etc.) that specific User in that specific Role has for | |
| that specific Model entity. These authorization methods in the Controller | |
| can also provide error indications and descriptive text that can be | |
| displayed to the User by the View. | |
| ---- | |
| _Copyright 2008 Google Inc._ | |
| _This work is licensed under a_ | |
| [http://soc.googlecode.com/svn/wiki/html/licenses/cc-by-attribution-2_5.html Creative Commons Attribution 2.5 License]. | |
| [http://creativecommons.org/licenses/by/2.5/ http://soc.googlecode.com/svn/wiki/html/licenses/cc-by-2_5-88x31.png] |