Delphi Support for ABC's


Delphi Mechanisms for ABC Programming

  • Delphi allows the designer to declare methods virtual; abstract; -- virtual, to allow derived classes to override the method in place, and abstract, to require them to (a class which declares a method abstract cannot implement it at all)
  • Delphi's properties can be made "abstract virtual" by binding them to virtual Get/Set methods. Clients of the ABC thus get the best of both component programming (natural syntax for accessing/assigning attributes), and OO (reduction of coupling dependenies on other modules' implementations).
  • Delphi also provides a construct, called a class reference, for implementing several neat mechanisms around ABC's. Essentially, a class reference functions as a handle to the virtual function table of a class, allowing you to call methods which are declared virtual but which do not require access to a specific instance of a concrete class. This feature is especially useful for implementing object factories.

Thumb Rules

ABC's should consist of the following elements: 
  • "Normal" public ABC methods, declared virtual; abstract;
  • Public and published properties, declared in terms of Get/Set methods (no data fields!)
  • The protected Get/Set methods, likewise declared virtual; abstract;
  • Public "template" methods, not declared virtual or abstract. These methods are implemented solely in terms of the "normal" ABC methods and the "virtual" properties, and serve to provide a controlled sequence of invocation of some part of the ABC interface.

TOC | Previous | Next

Copyright 1997, Palladion Software. 

Please report any problems with this page to Tres Seaver, tseaver@palladion.com.