Motivation Architecture Implementation Demo Deme Architecture Todd Davies Mike Mintz Stanford University Stanford Open Source (un)conference ’08 Davies, Mintz Deme Architecture
Jan 15, 2015
MotivationArchitecture
ImplementationDemo
Deme Architecture
Todd Davies Mike Mintz
Stanford University
Stanford Open Source (un)conference ’08
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Outline
1 Motivation
2 ArchitectureItem StructureItem OntologyViewers
3 Implementation
4 Demo
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Outline
1 Motivation
2 ArchitectureItem StructureItem OntologyViewers
3 Implementation
4 Demo
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Outline
1 Motivation
2 ArchitectureItem StructureItem OntologyViewers
3 Implementation
4 Demo
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Outline
1 Motivation
2 ArchitectureItem StructureItem OntologyViewers
3 Implementation
4 Demo
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Objectives
Hierarchy of item types with shared functionalityVersioning for every item type
Not just documentsHighly collaborative
Every item type supports discussion
Very granular permissionsEasily ExtensibleEmbedded views
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Objectives
Hierarchy of item types with shared functionalityVersioning for every item type
Not just documentsHighly collaborative
Every item type supports discussion
Very granular permissionsEasily ExtensibleEmbedded views
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Objectives
Hierarchy of item types with shared functionalityVersioning for every item type
Not just documentsHighly collaborative
Every item type supports discussion
Very granular permissionsEasily ExtensibleEmbedded views
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Objectives
Hierarchy of item types with shared functionalityVersioning for every item type
Not just documentsHighly collaborative
Every item type supports discussion
Very granular permissionsEasily ExtensibleEmbedded views
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Objectives
Hierarchy of item types with shared functionalityVersioning for every item type
Not just documentsHighly collaborative
Every item type supports discussion
Very granular permissionsEasily ExtensibleEmbedded views
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Objectives
Hierarchy of item types with shared functionalityVersioning for every item type
Not just documentsHighly collaborative
Every item type supports discussion
Very granular permissionsEasily ExtensibleEmbedded views
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Outline
1 Motivation
2 ArchitectureItem StructureItem OntologyViewers
3 Implementation
4 Demo
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
What is an item?
All persistent data abstracted as itemsE.g., documents, users, settings, etc.
Items are instances of “item types”Item types specify structure of fieldsItems provide values for fields
E.g. “Person” is item type, “Mike” and “Todd” are items ofthat typeFirst Name Last Name
Mike MintzTodd Davies
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
What is an item?
All persistent data abstracted as itemsE.g., documents, users, settings, etc.
Items are instances of “item types”Item types specify structure of fieldsItems provide values for fields
E.g. “Person” is item type, “Mike” and “Todd” are items ofthat typeFirst Name Last Name
Mike MintzTodd Davies
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
What is an item?
All persistent data abstracted as itemsE.g., documents, users, settings, etc.
Items are instances of “item types”Item types specify structure of fieldsItems provide values for fields
E.g. “Person” is item type, “Mike” and “Todd” are items ofthat typeFirst Name Last Name
Mike MintzTodd Davies
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Item inheritance
Item types can inherit from other item types“Item” is at top of the hierarchyE.g., Item -> Document -> Comment
Item types inherit existing fields, add additional fieldsItem: name, descriptionDocument: name, description, bodyComment: name, description, body, commented_item
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Item inheritance
Item types can inherit from other item types“Item” is at top of the hierarchyE.g., Item -> Document -> Comment
Item types inherit existing fields, add additional fieldsItem: name, descriptionDocument: name, description, bodyComment: name, description, body, commented_item
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Outline
1 Motivation
2 ArchitectureItem StructureItem OntologyViewers
3 Implementation
4 Demo
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Overview
AgentsCollectionsDocumentsRelationshipsPermissionsURLs
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
All Items
All items share metadata structure:Unique IDNameDescriptionCreator / Create TimeUpdater / Update TimeVersionsTrashed?
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Agents
AgentsItem that can “do” things
(Given permissions, can appear as creator/updater)
Application user is always a specific AgentSubclasses: Person, AnonymousAgent, Group
GroupsCollection of AgentsMembers can share common permissions
AccountsChannel of authenticationSubclasses: PasswordAccount, OpenId
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Agents
AgentsItem that can “do” things
(Given permissions, can appear as creator/updater)
Application user is always a specific AgentSubclasses: Person, AnonymousAgent, Group
GroupsCollection of AgentsMembers can share common permissions
AccountsChannel of authenticationSubclasses: PasswordAccount, OpenId
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Agents
AgentsItem that can “do” things
(Given permissions, can appear as creator/updater)
Application user is always a specific AgentSubclasses: Person, AnonymousAgent, Group
GroupsCollection of AgentsMembers can share common permissions
AccountsChannel of authenticationSubclasses: PasswordAccount, OpenId
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Collections
ItemSetsArbitrary collection of itemsSubclasses: Folio
FolioEvery group has one folioContains items shared among all members
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Collections
ItemSetsArbitrary collection of itemsSubclasses: Folio
FolioEvery group has one folioContains items shared among all members
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Documents
Main unit of collaborative workDifferent item types for different formatsSubclasses
TextDocumentHtmlDocumentDjangoTemplateDocumentComment
FileDocumentImageDocument
Comments refer to other ItemsSometimes specific versions and locations
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Documents
Main unit of collaborative workDifferent item types for different formatsSubclasses
TextDocumentHtmlDocumentDjangoTemplateDocumentComment
FileDocumentImageDocument
Comments refer to other ItemsSometimes specific versions and locations
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Documents
Main unit of collaborative workDifferent item types for different formatsSubclasses
TextDocumentHtmlDocumentDjangoTemplateDocumentComment
FileDocumentImageDocument
Comments refer to other ItemsSometimes specific versions and locations
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Relationships
Explicit items for relationships between itemsSubclasses: GroupMembership, ItemsetMembership
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Permissions
Specifies who can do what to which itemsAgentAbilityItem
Three levelsDirectGroupwideDefault
RolesCustomizable sets of abilities
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Permissions
Specifies who can do what to which itemsAgentAbilityItem
Three levelsDirectGroupwideDefault
RolesCustomizable sets of abilities
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Permissions
Specifies who can do what to which itemsAgentAbilityItem
Three levelsDirectGroupwideDefault
RolesCustomizable sets of abilities
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Custom URLs
Users can create custom URLs to point to itemsEach domain can have separate namespace of URLs
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Custom URLs
Users can create custom URLs to point to itemsEach domain can have separate namespace of URLs
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Outline
1 Motivation
2 ArchitectureItem StructureItem OntologyViewers
3 Implementation
4 Demo
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
What is a viewer?
A Django class that processes browser or API requestsURLs that begin with /resource/ are routed to viewersViewers handle items of specific typeViewers inherit from other viewers
Everything ultimately inherits from ItemViewerItemViewer is about 80% of view code
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
What is a viewer?
A Django class that processes browser or API requestsURLs that begin with /resource/ are routed to viewersViewers handle items of specific typeViewers inherit from other viewers
Everything ultimately inherits from ItemViewerItemViewer is about 80% of view code
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
What is a viewer?
A Django class that processes browser or API requestsURLs that begin with /resource/ are routed to viewersViewers handle items of specific typeViewers inherit from other viewers
Everything ultimately inherits from ItemViewerItemViewer is about 80% of view code
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
What is a viewer?
A Django class that processes browser or API requestsURLs that begin with /resource/ are routed to viewersViewers handle items of specific typeViewers inherit from other viewers
Everything ultimately inherits from ItemViewerItemViewer is about 80% of view code
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
RESTful URLs
Entry actions/resource/<viewer>/<id>/<action>E.g., /resource/person/5/editE.g., /resource/person/5
Collection actions/resource/<viewer>/<action>E.g., /resource/person/newE.g., /resource/personE.g., /resource/person.json
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
RESTful URLs
Entry actions/resource/<viewer>/<id>/<action>E.g., /resource/person/5/editE.g., /resource/person/5
Collection actions/resource/<viewer>/<action>E.g., /resource/person/newE.g., /resource/personE.g., /resource/person.json
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Authentication
There is always an authenticated agent in a viewer(If user does not log in, it is AnonymousAgent.)
Viewer takes care of checking permissions forauthenticated agent
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Item StructureItem OntologyViewers
Authentication
There is always an authenticated agent in a viewer(If user does not log in, it is AnonymousAgent.)
Viewer takes care of checking permissions forauthenticated agent
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Deme is written in Django
Deme is:A collection of Django modelsA system of hierarchical viewers that use Django templatesAdditional components that handle Deme-specific features
VersioningPermissionsCommenting
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Why Django?
Big developer communityNow supports multi-table inheritance
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Models –> Item types
A Django model corresponds to an item typeAn item is:
A Django model instanceA row in a table
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Models –> Item types
A Django model corresponds to an item typeAn item is:
A Django model instanceA row in a table
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Database Visual
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Versioning
Every table has a dual version-table
PersonID First Name Last Name1 Mike Mintz
PersonVersionID Version First Name Last Name1 1 Michael Mintz1 2 Mike Mintz
Davies, Mintz Deme Architecture
MotivationArchitecture
ImplementationDemo
Demo time!
Davies, Mintz Deme Architecture