Uploaded image for project: 're-motion'
  1. re-motion
  2. RM-3715

Provide a ComposedObject base class for the Mixin-based composition pattern

    Details

      Description

      Add a ComposedObject base class for the Mixin-based composition pattern.

      The class acts as a convenience base class for domain objects in the mixin-based composition pattern. It provides a This property that allows access to the composed interface, and a NewObject<TComposite> factory method that acts as a factory method for subclasses.

      When a class inherits members provided by mixins, those additional members are only available by casting the class instance to the respective interfaces introduced by the mixins. This can be cumbersome, so the concept of complete interfaces was added. A complete interface combines public members of the mixed class with members introduced by mixins. The target class members are added to the complete interface either by having the complete interface extend an interface also implemented by the target class, or by simply redeclaring the members of the target class on the complete interface. The mixin members are added to the complete interface by having the complete interface extend the interfaces introduced by the mixins.

      While complete interfaces provide easy access to the members added by mixins, they still require one cast (from the target class instance to the complete interface). To remove the need for this cast, classes implementing mixin-based composition can use the ComposedObject base class. When a class derives from ComposedObject<TComposedInterface>, it defines a complete interface for itself and all the mixins it composes via the UsesAttribute. That complete interface is called the composed interface.

      The ComposedObject base class associates the composed interface with the derived class and provides a This property allowing access to all the members provided by the class and the composed mixins.

        Attachments

        There are no Sub-Tasks for this issue.

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              fabian.schmied Fabian Schmied
              Reporter:
              stefan.papp Stefan Papp
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2 hours
                2h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h