Applying contracts to abstract base class?
From: Ken (kk_oop_at_yahoo.com)
Date: 10/27/03
- Next message: Donald Roby: "Re: IGNORE testing new news service"
- Previous message: Thomas Gagné: "Re: OO's best feature survey results"
- Next in thread: Daniel T.: "Re: Applying contracts to abstract base class?"
- Reply: Daniel T.: "Re: Applying contracts to abstract base class?"
- Reply: Stefan: "Re: Applying contracts to abstract base class?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Oct 2003 05:12:08 -0800
Hi. I'm looking to find a way to apply Design by Contract in my C++
programs.
The problem that I'm having deals with interface base classes (a base
class with only pure virtual methods). Since these are often how an
object gets exposed to clients via polymorphism, it seems critical
that an abstract base class can define and enforce its contracts.
Defining contracts is critical, so LSP can
be utilized when defining derived implementation classes. However, if
the interface base class defines a method to enforce its contract, it
will no longer be an abstract interface. This poses a problem, for
instance, if the abstract class is being used to apply multiple
interface inheritance. In that case, the abstract class really needs
to be pure abstract, otherwise it will result in having multiple
implementation inheritance, which, in C++, is a risky, undesireable
design.
Is there a way for C++ to somehow enable an interface base class to
enforce its contracts? Seems like an unfixable paradox.
Any thoughts?
Thanks,
Ken
- Next message: Donald Roby: "Re: IGNORE testing new news service"
- Previous message: Thomas Gagné: "Re: OO's best feature survey results"
- Next in thread: Daniel T.: "Re: Applying contracts to abstract base class?"
- Reply: Daniel T.: "Re: Applying contracts to abstract base class?"
- Reply: Stefan: "Re: Applying contracts to abstract base class?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|