Adding abstract class...
From: bobsled (sleding_at_sands.com)
Date: 04/24/04
- Next message: Daniel T.: "Re: Aggregation vs composition"
- Previous message: Daniel T.: "Re: Aggregation vs composition"
- Next in thread: Robert C. Martin: "Re: Adding abstract class..."
- Reply: Robert C. Martin: "Re: Adding abstract class..."
- Reply: Daniel T.: "Re: Adding abstract class..."
- Reply: AndyW: "Re: Adding abstract class..."
- Reply: Ilja Preuß: "Re: Adding abstract class..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 24 Apr 2004 17:47:12 GMT
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."
I have some question and want to ask him:
1. Is the difference between interface and abstract base class is the former
consists only pure virtual functions but no member of data and no
non-pure-virtual function, and the latter has at least one pure virtual
function and either some members of data or non-pure-virtual function?
2. Is keeping adding such kind of abstraction into class hierarchy not going
to gain performance penalty?
3. Is there any general rule for such kind of adding abstract class?
Thank you for your comments!
- Next message: Daniel T.: "Re: Aggregation vs composition"
- Previous message: Daniel T.: "Re: Aggregation vs composition"
- Next in thread: Robert C. Martin: "Re: Adding abstract class..."
- Reply: Robert C. Martin: "Re: Adding abstract class..."
- Reply: Daniel T.: "Re: Adding abstract class..."
- Reply: AndyW: "Re: Adding abstract class..."
- Reply: Ilja Preuß: "Re: Adding abstract class..."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|