Abstract Data Types in C

Dan Capshaw sdc at capshaw.UUCP
Sun Oct 16 03:16:59 AEST 1988


A friend that does a lot of program development in PASCAL has
found that using Abstract Data Types (ADTs) significantly
increases his productivity by minimizing his debugging time.  He
describes an ADT as being a data structure or set of data structures
combined with an exclusive set of allowable operations on those structures
that are placed into a module.  The module is essentially a black box
to the main program and to the programmer (if they didn't code the module)
that is called when an operation needs to be performed on the ADT.

For example, suppose you wanted to create an ADT called FRAC that could
be used to perform various operations on a fraction--such as 'put numerator',
'put denominator', 'get numerator', ... 'find fractional equiv. of a real'...
etc.  FRAC would be used to perform these operations in a standard way 
without the need for the programmer to worry about how FRAC performs its
job.  In fact, the module's source code may not even be available to the
programmer.

One reason my friend doesn't like C is because he doesn't feel
ADTs can be used effectively in C.  But to me, it seems like he is
just describing standard function calls where the interface is defined
but how the function performs its job may not be.  So...I don't see
the advantage of ADTs and how they are superior to the structured 
programming techniques that I have been using for years.

Is anyone out there using ADTs in C?  If so, am I missing something
here?  And finally, if ADTs are not as I have described them, what
are they, and how can they be used in C (if in fact they should be used
in C)?
-- 
Dan Capshaw			|	...!uunet!capshaw!sdc
4664 Panther Lake Rd. W.	|	206-275-0158
Bremerton, WA 98312		|



More information about the Comp.lang.c mailing list