Re: Abstract Data Types - Separating Interface from Implementation

From: Anon Email (anonemail1_at_fastmail.fm)
Date: 12/24/03


Date: 23 Dec 2003 21:32:04 -0800

Thanks guys.

> You seem to be confusing implementation code and client code.

Yes, you are right - I am confused. I'm confused by the terms
implementation code, client code and interface. And I'm unsure as to
why abstract data types are called "abstract".

1) Put simply, is client code non-class code?
2) Is the aim to make a class interface like a "skeleton" of the class
implementation?
3) Is the class interface typically found in your header file?
3) Is the class implementation typically found in your source file?
4) Are abstract data types "abstract" because they are specified
separate to implementation?
5) In Bjarne Stroustrup's "The C++ Programming Language" on p317, he
talks about the class "I_box," and seems to use the terms "interface"
and "implementation" interchangably. Is there such a thing as an
"implementation interface", as opposed to an interface?

The following is confusing for me:

" Our implementation choice is to use an array of integers. It would
be nice to be able to separate the interface from the implementation.
In some languages it is actually possible. Not so in C++ (or, at
least, not without some gymnastics). The reasons are mostly
technological. The compiler would have to have knowledge about all the
files involved in the project in order to allow for such separation.

 In C++, the best we can do is to separate the details of the
implementation of some member functions into the implementation file.
The interface file, however, must contain the definition of the class,
and that involves specifying all the data members. Traditionally,
interfaces are defined in header files with the .h extension. Here is
the stack.h interface file."

This comes from the following page on abstract data types:

http://www.relisoft.com/book/lang/scopes/11abstr.html

I'm trying to envision his "ideal" situation, where the interface is
separated completely from the implementation. Any further insight
greatly appreciated.

Cheers,

Deets



Relevant Pages

  • Re: object system...
    ... In a typed system you can separate implementation from the interface ... How to express in the language a wish to delegate, A of X to B of Y. ... Performance of hash tables is less predictable, ...
    (comp.object)
  • Re: Abstract Data Types - Separating Interface from Implementation
    ... >>You seem to be confusing implementation code and client code. ... I don't define any of the functions yet, I just declare them and compile ... Each such file defines an *interface*. ...
    (comp.lang.cpp)
  • Re: Separate Compilation in Programming Languages
    ... within one package body. ... all, separate or otherwise. ... OK, so you like having textually separate spec and body, ... Clients of an interface do not depend ...
    (comp.lang.ada)
  • Re: Separate Compilation in Programming Languages
    ... within one package body. ... all, separate or otherwise. ... OK, so you like having textually separate spec and body, ... Clients of an interface do not depend ...
    (comp.lang.ada)
  • Re: object system...
    ... In a typed system you can separate implementation from the interface ... C/I is also unable to effectively facilitate some non-C/I languages, ... Performance of hash tables is less predictable, ...
    (comp.object)