Why ABC's make bad Interfaces
From: christopher diggins (cdiggins_at_videotron.ca)
Date: 04/08/04
- Next message: Ilja Preuss: "Re: Composite. Again!"
- Previous message: sp: "modeling for ejb application"
- Next in thread: Robert C. Martin: "Re: Why ABC's make bad Interfaces"
- Reply: Robert C. Martin: "Re: Why ABC's make bad Interfaces"
- Reply: Thomas Gagné: "Re: Why ABC's make bad Interfaces"
- Reply: Dave Harris: "Re: Why ABC's make bad Interfaces"
- Reply: Kevin Cline: "Re: Why ABC's make bad Interfaces"
- Maybe reply: cstb: "Re: Why ABC's make bad Interfaces"
- Maybe reply: cstb: "Re: Why ABC's make bad Interfaces"
- Maybe reply: Isaac Gouy: "Re: Why ABC's make bad Interfaces"
- Reply: Peter Ammon: "Re: Why ABC's make bad Interfaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 8 Apr 2004 15:05:26 -0400
The following is from an article I placed on the HeronFront web site (
http://www.heron-language.com/heronfront.html ) which attempts to explain
the differences between Abstract Base Classes (ABC) and Interfaces :
-- Many programmer's make the mistake of assuming that an interface is equivalent to an Abstract Base Class (ABC). This is an easy mistake to make because it is common practice to implement an interface using ABC's. An ABC provides virtual functions that are overridden in the inheriting class, which in many object oriented programing language (OOPL) implementations means that each instance of the implementing (inheriting) class requires a new vtable for each inherited ABC. The problem with the ABC approach is that we have code bloat within objects because of each vtable. Our objects can rapidly become too big and slow due to all of the neccessary vtables and lookups. In contrast with ABC's, when we talk of a class implementing an interface, we know that there will only ever be one implementation function for each method so there is no reason for a vtable. In order to refer to an object by its interface without knowing its type we can do this with "fat" pointer made up of two pointers, one to the object instance and another to a static interface function lookup table. -- I am interested in hearing any comments on this post, in order to make it as accurate and non-language biased as possible. TIA. Christopher Diggins http://www.cdiggins.com http://www.heron-language.com
- Next message: Ilja Preuss: "Re: Composite. Again!"
- Previous message: sp: "modeling for ejb application"
- Next in thread: Robert C. Martin: "Re: Why ABC's make bad Interfaces"
- Reply: Robert C. Martin: "Re: Why ABC's make bad Interfaces"
- Reply: Thomas Gagné: "Re: Why ABC's make bad Interfaces"
- Reply: Dave Harris: "Re: Why ABC's make bad Interfaces"
- Reply: Kevin Cline: "Re: Why ABC's make bad Interfaces"
- Maybe reply: cstb: "Re: Why ABC's make bad Interfaces"
- Maybe reply: cstb: "Re: Why ABC's make bad Interfaces"
- Maybe reply: Isaac Gouy: "Re: Why ABC's make bad Interfaces"
- Reply: Peter Ammon: "Re: Why ABC's make bad Interfaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|