Path: utzoo!attcan!uunet!husc6!xait!mirror!frog!john From: john@frog.UUCP (John Woods) Newsgroups: comp.lang.c Subject: Re: Abstract Data Types in C Summary: Of course Keywords: Abstract Data Types ADT modules Message-ID: <1228@X.UUCP> Date: 19 Oct 88 01:41:00 GMT References: <116@capshaw.UUCP> Organization: Servants of the Great White Frog Lines: 33 In article <116@capshaw.UUCP>, sdc@capshaw.UUCP (Dan Capshaw) writes: > 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... > One reason my friend doesn't like C is because he doesn't feel > ADTs can be used effectively in C... > Is anyone out there using ADTs in C? Almost anyone using the Standard IO library functions are using an Abstract Data Type (excluding the few mutants who JUST HAVE to personally fiddle with _cnt or _ptr). There may be a strong tendancy for C programmers to make sure that the details of their data types are visible (so they can "maximize" efficiency by banging structure elements, for example), yet C is perfectly amenable to data abstraction (with just a hint of programmer discipline). By way of contrast: the CLU language (invented by Liskov (and others?) at MIT) is all about data abstraction, and makes it a natural part of the language; a number of CLU adherents maintain that you cannot do data abstraction without such language support. However, I took the Software Engineering course the year before the CLU compiler was ready, and they taught data abstraction using plain old PL/I, with a few little library tricks to make sure that abstract pointers stayed abstract: they insisted that you tag structures with the name of the abstraction, and that you use their "up" and "down" routines to turn real pointers into opaque pointers and vice versa; an opaque pointer had its address modified so it was invalid and would cause a progam crash if referenced as if it were real. -- John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101 ...!decvax!frog!john, john@frog.UUCP, ...!mit-eddie!jfw, jfw@eddie.mit.edu Goooooood Morning Discovery! -Robin Williams Abracadabra, 'press to MECO', America is back in space!