On 19/02/20 12:15 p. m., Esteban Maringolo wrote:
On Wed, Feb 19, 2020 at 2:09 PM Richard Sargent <richard.sargent@gemtalksystems.com> wrote:
If you want to have a limited API, you wrap a dictionary with a new class that exposes just the API you desire consumers to use.
In general, inheritance is often overused or/ misused. Composition is usually a better technique unless you want the full API of the hierarchy to be available and used. +1 to this.
Inheriting means accepting the "interface contract" of being able to respond to all the messages understood by its superclasses. It also limits your model to future refactorings and modifications.
I rarely, if ever, sub-classify any "base" class for domain modelling, and more so in the case of Collection classes, and when I had to deal with domain classes that did that, it always caused more problems than solutions.
Regards,
Esteban A. Maringolo
Thanks for all your answers in the thread. I think that I see how this can be done now. Cheers, Offray