« Return to Thread: [squeak-dev] My view on Traits

Re: [squeak-dev] Re: My view on Traits

by Ryan Mitchley :: Rate this Message:

Reply to Author | View in Thread

Sophie2 wrote:
What about
  Y plays role R1, and role R2

e.g. a Car plays the role of TransportationVehicle and CollateralAsset.

The "state" related to these two roles are not independent: as you rack up
miles on the transportation vehicle, the asset collateral value drops; when
the asset is hauled away for non-payment, the transportation vehicle is not
available.
It is precisely Car's function to mediate between its parts (and provide a useful interface). The containing class provides the "glue". If the parts have good interfaces and have been well designed, the interaction will be well manageable. A fundamentally complex relationship would require fundamentally complex interactions.

The interaction between TransportationVehicle>>Miles and CollateralAsset>>Value would be radically different for, say, a Ferrari F430 and a Fiat Seicento (apologies to any offended!). It would be a function of the particular Car instance.

I think we could agree that seizure would be physically constrained to the Car! (that the seizor cared chiefly about the CollateralAsset is irrelevant...)

 « Return to Thread: [squeak-dev] My view on Traits

LightInTheBox - Buy quality products at wholesale price