Hello,<div><br class="webkit-block-placeholder"></div><div>Can anyone give me a simple Traits example? &nbsp;I am trying to figure out if it would be useful for me in the context of developing Aida applications.</div><div><br class="webkit-block-placeholder">
</div><div>In Aida, a WebApplication observes a domain model object. &nbsp;Let&#39;s call it WebAppModel.</div><div><br></div><div>Of course, you could subclass ANY object to create your WebAppModel, but I still want it to know how to do certain things, like start and stop itself.</div>
<div><br class="webkit-block-placeholder"></div><div>In other words, I might have one WebAppModel that subclasses Object, and another that subclasses OrderedCollection, but I don&#39;t want to teach them both how to start or stop each time I create a new one, and it seems less elegant to subclass everything from a WebAppModel base class and then include the actual objects they model as instance variables.</div>
<div><br class="webkit-block-placeholder"></div><div>Does this make sense or am I missing some other fundamental concept, and is this what Traits are for?<br></div><div><br class="webkit-block-placeholder"></div><div>Thanks,</div>
<div><br class="webkit-block-placeholder"></div><div>Rob Rothwell</div>