Re: BonoboControl-based class



On 7 Dec 2001, Rodrigo Moya wrote:
> yes, I was confused, I wasn't even deriving my CORBA interface from
> Bonobo::Control. Doing what you say made it work :-) (which is how it
> was for the GNOME 1.x version)
>
> BTW, why is it a bad idea to inherite from Bonobo::Control?

        ARGH ! - please, please, please do not derive from
Bonobo::Control, it's just an appalling idea almost all of the time.

        Simply because it's easy to do; doesn't mean you should do it.
Please read my self-help on the subject - article 2:

[snip]
* Inheriting vs. Aggregating.

        By cunningly opening a bumper value, super size, 'new
formula', can of worms, I plan to bring Gnome productivity to a total
halt so here goes: I've seen interfaces that look like something like
this[1]:

        interface Foot : Bonobo::BodyPart {
                long  getNumberDigets ();
                void  setCompressiveForce (double forceInNewtons);
        };

        Whilst all well and good [2] there is no particularly good
reason to derive a Foot from BodyPart. Indeed, it ties the perfectly
generic and re-usable Foot interface to a body, and ignores the
thousands of lattice propelled ACME mechanical feet not to speak of
the humble prosthesis.

        Consequently before inheriting consider -

                * Do I really need to.

                * Is the derived interface unarguably inextricably
                  intertwined with the parent.

                * Why my interface is totaly non-generic; should I not
                  be re-using a generic interface, such as a property
                  bag in the above example.

                * Whether the IRS inheritance tax form 7165B is really
                  worth filling in, wouldn't it be better to leave
                  everything to Battersea Dogs Home ?

        I have seen inheritance badly misused, please write nice
separate generic interfaces and aggregate them together.

        Also, when you see a huge and cumbersome interface replete
with get and set methods, carefuly consider using a PropertyBag
instead.
[snip]

        Regards,

                Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]