Useful Information about properties and messages
- if a entity should do something, create a property. if there are global aspects, create a manager.
- Read-Access to all attributes of all entitys is allowed for all propertys and managers
- Write-Access to attributes _only_ should be done by the owner property, the one that setups and maintains the attribute on the entity. if you need to modify a attribute that a foreing property controlls, use a msg! Thats the only way to make shure that a property could react on attribute changes.
- never ever expect that a entity has a property! Never iterate the attached propertys nor search one of them! If you need to communicate create a message! If nobody listen to your msg, this is not a bug! (maybe undesired, but common!) You never know which property will listen to a msg, so searching one by type will create great pain!
- if you need to ask a value, think if you should add a attribute to the entity, so this attribute could be asked direct. If not possible (lists and other specials) create a Msg with a slot for the result and execute it Sync(). This would direct call HandleMsg and the result could be passed in the msg.
From Nebula-Discuss Mailinglist
Link to this Page