Re: Adding abstract class...

From: Daniel T. (postmaster_at_eathlink.net)
Date: 05/30/04


Date: Sun, 30 May 2004 14:33:54 GMT

In article <c6iecq$vuq$1@stu1id2.ip.tesion.net>,
 "Ilja Preuß" <preuss@disy.net> wrote:

>Daniel T. wrote:
>> "bobsled" <sleding@sands.com> wrote:
>>
>>> Here's a post from Uncle Bob...
>>>
>>> "In C++ dependencies are very expensive, so isolation is that much
>>> more important. Therefore I think it is often best to keep the
>>> interface and add the abstract class below it. In Java or C# the
>>> dependencies are not quite as expensive, and need for isolation not
>>> quite as great. However, since abstract classes cannot be multiply
>>> inherited, it's still probably best to keep the interface and add
>>> the abstract class below it.
>>>
>>> On the other hand, if you started with an abstract class, and did not
>>> have an interface; and if the system was working well without the
>>> interface, I'm not sure I'd add it right away. I'd wait until some
>>> event occurred that made the need for the interface obvious."
>>
>> But then one would have to ask, why did we start with an abstract
>> class in the first place?
>
>Because we needed to define some common behaviour?

There you go, when definition common behaviour isn't it better to
compose rather than inherit?