Why are Scala’s Either and Option types not interfaces/traits but classes?
I wanted to create a class CompileResult
, that can be treated like an Either type but has some additional useful methods. It should be a CompileSuccess
or a CompileFailure
(which, too, has some extended functionality). However I can’t do that because Either
is an abstract class
and I don’t want to extend it but rather use delegation and have an Either
stored internally.
How to use scala case classes when delegation is needed
Let’s assume in our application we want to model cars. We also want to model a car repository where we store some registered cars. How should that be modeled in scala?
How to use scala case classes when delegation is needed
Let’s assume in our application we want to model cars. We also want to model a car repository where we store some registered cars. How should that be modeled in scala?
How to use scala case classes when delegation is needed
Let’s assume in our application we want to model cars. We also want to model a car repository where we store some registered cars. How should that be modeled in scala?
How to use scala case classes when delegation is needed
Let’s assume in our application we want to model cars. We also want to model a car repository where we store some registered cars. How should that be modeled in scala?
Language support for (syntactic) delegation in Java
Composition over inheritance is an old trend or even accepted state of the art in object oriented programming. It would be even easier to use in Java, if there were language support for delegation. Our IDEs, like eclipse, allow for easy generation of delegating methods, but the result is terrible code clutter. I would rather like to see something like
Delegating work and programming to component interfaces
I have a MessageHandler class which receives and validates messages before determining which components in the architecture they should be delegated to so they can be processed. This involves calling functions with different names and possibly different signatures on classes in different components.
Delegating work and programming to component interfaces
I have a MessageHandler class which receives and validates messages before determining which components in the architecture they should be delegated to so they can be processed. This involves calling functions with different names and possibly different signatures on classes in different components.
Delegating work and programming to component interfaces
I have a MessageHandler class which receives and validates messages before determining which components in the architecture they should be delegated to so they can be processed. This involves calling functions with different names and possibly different signatures on classes in different components.
Do conditional delegation or different member types break the Composite pattern?
Here’s how I understand the composite pattern: