[Opensim-dev] OpenSim.Model

Stefan Andersson stefan at tribalmedia.se
Sat Apr 12 09:11:47 UTC 2008


Sean asked me to outline the 'Model' concept proposed by me and MW and give examples of what classes would move there.
 
To put it simple, 'Model' as we mean it, is more or less identical to the 'Model' koncept of the MVC pattern
 
http://en.wikipedia.org/wiki/Model-view-controller
 
A 'model' is "The domain-specific representation of the information on which the application operates" together with raw data calculations, as calculating current age from birthday et c - and data integrity enforcement, as for example range checks.
 
The Model does not ACT in the system, but is OBSERVED and ACTED UPON.
 
Since the model does not act, it never calls on references to (non-trivial) outside types - ie, UserProfile can expose an IUserProfileService (hypothetically a reference to the service that produced it) but it will never CALL on it.
 
The model assembly should be self-contained in that it should not reference any libraries but the .net System assemblies. This makes it very easy to re-use in other contexts.
 
While this pattern works best in a SOA or MVC system, just having the model layer brings several benefits:
 
* Over time, the code starts to move towards better control over state and state-changes (by forcing state-changing behaviour out of the state containers) decoupling and integrity enforcement.
* The Model can be acted upon by several different contexts, such as
  * Data Serialization (Database, Xml, Remoting)
  * Aux Services (UGAI, Web interfaces, inter-grid logic)
  * Unit and integration Tests
  * Building Tools and Third-party services and applications (that can re-use the model for their inner representation)
 
Now, since we don't have a fully implemented 'controller' orientation, inheritance has to be side-stepped by formulating the type as interface instead of class. It's less than perfect, but better than nothing.
 
(For example, currently the SceneObjectGroup is an EntityBase, which means that we would need to inherit the model (data) parts from the model layer and the acting parts (functions) from the business logic layer, which can't be done in a single-inheritance language as c# - so, what we have to do is to at least implement IEntityBase and ISceneObjectGroup, probably supplying classes EntityBaseImpl and SceneObjectGroupImpl for data manipulation purposes only)
 
We believe this would be a big step forward towards getting the architecture under control and to facilitate third-party extension support.
 
Best regards,
Stefan (lbsa71)
 
** Addendum **
Some prime candidates for OpenSim.Model (think of what it would mean to have esay access to these types from other contexts, like your own UGAI, Application or Web site)
 
UUID
Asset, IAssetAssetLandmark
Texture, ITexture
Wearable, IWearable
Estate, IEstate
Region, IRegion (formerly SimpleRegionInfo)
Scene, IScene
ScenePresence
Avatar, IAvatar
SceneObjectGroup, ISceneObjectGroup
SceneObjectPart, ISceneObjectPart 
Shape, IShape
FriendRelation (formerly FriendListItem)
IInventoryNode
InventoryFolder
InventoryItem
LandData
UserProfile, IUserProfile (formerly UserProfileData)
 
IAssetService
IUserProfileService
IAvatarService
IAuthenticationService
IRegionService
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://opensimulator.org/pipermail/opensim-dev/attachments/20080412/aa08039c/attachment-0001.html>


More information about the Opensim-dev mailing list