What is an "Abstract Data Type"?

P

Pascal

Hi, together!

I know that there are so called

1. Fundamental Data Types
2. Reference Data Types

in Java - now somebody asked me the question: "What is an Abstract Data
Type??". Does anyone of you know? I didn't find an answer, I looked into
the www, into my books... nothing!

Thanks in advance
Pascal
 
A

Andrea Desole

Pascal said:
Hi, together!

I know that there are so called

1. Fundamental Data Types
2. Reference Data Types

in Java - now somebody asked me the question: "What is an Abstract Data
Type??". Does anyone of you know? I didn't find an answer, I looked into
the www, into my books... nothing!

Strange, I just typed "abstract data type" in google and I had thousands
of results. Here is one:

http://en.wikipedia.org/wiki/Abstract_data_type
 
P

Pascal

Thank you very much, I don't know, but I really looked hours into the
www, searching with google, Copernic...etc, but I didn't find such an
easy explanation:

Abstract Data Type == Synonym for Interface

Thanks!
 
D

David Van de Voorde

An abstract data type is really about encapsulation. The "user" of the
datatype should not be concerned about the internal "management" of the
object. He only needs to know about the methods available to him in order to
use the class. I.e. all details are hidden. That's why they call it
"abstract".

David.
 
A

Andrea Desole

Pascal said:
Thank you very much, I don't know, but I really looked hours into the
www, searching with google, Copernic...etc, but I didn't find such an
easy explanation:

well, maybe a typo, can happen.
Abstract Data Type == Synonym for Interface

this is a more "implementation oriented" way to look at it, specially if
you are using Java. However, you can define an ADT without using
interfaces (some languages don't even have interfaces).
A better way to look at it is to look at the operations you can do on
that type, like a kind of "protocol" the type exposes. An interface is a
good way to do that, but just don't think that ADT=interface, at least
not in the Java sense.
 
P

Pascal

Thanks for the good answers - well, the problem is that I don't know
other OOP-languages than Java, so I can't compare Abstract Data Types
realized in other languages; but nevertheless I got an impression what
it depicts. Danke!
 
S

Stefan Schulz

in Java - now somebody asked me the question: "What is an Abstract Data
Type??". Does anyone of you know? I didn't find an answer, I looked into
the www, into my books... nothing!

Well, it has been some time since my CS1 lectures, but i would define an
ADT as Data + Operations defined upon the Data. It is the "Skeleton" of
some concrete data type, that defines what the data represents, and how it
can be used. As such, it is more of a concept then any actual item you
will find in a programming language, though java's interfaces come close.
 
T

Tom Dyess

David Van de Voorde said:
An abstract data type is really about encapsulation. The "user" of the
datatype should not be concerned about the internal "management" of the
object. He only needs to know about the methods available to him in order
to
use the class. I.e. all details are hidden. That's why they call it
"abstract".

David.

Well, in a classic sense an abstract data type is quite different from
abstraction/encapsulation which I think David and Andrea are talking about.
An abstract data type, according to the definition below would be
implementation independent. The most common ADT would be a stack, heap or
queue, which can be implemented in an OOP manner or a procedural manner in
just about (if not all) languages. The data type is a stack, but it isn't a
primitave data type. Now the interesting question to chew on would be
according to this definition, would a Date be a primitave data type? I would
say yes because it can be implemented in several manners such as Julian
date, Delphi/Julian date (TDate/TDateTime), Calendar, Gregorian Calendar,
etc. Ahh, this brings me back to the good 'ole college days.

http://www.nist.gov/dads/HTML/abstractDataType.html
 
A

Andrea Desole

Tom said:
Well, in a classic sense an abstract data type is quite different from
abstraction/encapsulation which I think David and Andrea are talking about.

I'm not sure. I would probably agree on the encapsulation, but
abstraction is just the definition of the behaviour of an object,
indepedent of what the implementation or the inner features are. This is
pretty close to the meaning of ADT.
And the name ADT itself implies abstraction :)

An abstract data type, according to the definition below would be
implementation independent. The most common ADT would be a stack, heap or
queue, which can be implemented in an OOP manner or a procedural manner in
just about (if not all) languages. The data type is a stack, but it isn't a
primitave data type. Now the interesting question to chew on would be
according to this definition, would a Date be a primitave data type? I would
say yes because it can be implemented in several manners such as Julian
date, Delphi/Julian date (TDate/TDateTime), Calendar, Gregorian Calendar,
etc. Ahh, this brings me back to the good 'ole college days.

well, in this case the first question would be: what is a primitive data
type?
 
T

Tom Dyess

well, in this case the first question would be: what is a primitive data

Well, that's the interesting thing. Every object (as far as I can think of)
boils down to a aggregation of primitive data types, even if it is
aggregating object as well, because those objects boil down to primitives.
Delphi/Julian stores dates in the form of double with the whole numbers
representing days past a base date and the fraction representing the
fraction of a day. Gregorian/Java dates are stored as a long and represent
the number of milliseconds past a base date, so essentially, yes, they are
primitive data types, but no different than any other structure/object.

Concerning the ADT, back in high school days (late 80's early 90's) ADT was
always a conceptual structure only, like a stack/heap/queue. They were
defined by algorithmic pseudocode and could be implemented any way you like
as long as they followed the conceptual algorithm (has a pop, has a push,
LIFO, etc). Now, can they be implemented as an abstract class, with the pop
and push defined but not implemented therefore making it an abstract class,
but I think the two definitions are different with the common word
"abstract" in them. Granted, the early 90's have long since past and ADT
could have been anointed a new definition. As always though, I could be
wrong. :)
 
C

Chris Smith

Pascal said:
Hi, together!

I know that there are so called

1. Fundamental Data Types
2. Reference Data Types

in Java - now somebody asked me the question: "What is an Abstract Data
Type??".

It's just worth a quick mention that, despite the similarity of words,
ADTs don't fit into that classification. Primitive and reference types
really are the *only* two kinds of data types in Java. ADTs are a
conceptual thing, which doesn't really cleanly correspond to a type at
the language level.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
B

Brill2

Pascal,
The way that I learned ADT is simply put, it's your own custom type.
In java you can think of an object you create as an ADT. Everyone
here has given you very technical definitions but sometiems it's good
to get something very highlevel. Creating your own type consists of
putting other data and operations(methods/functions/procedures) that
change that data inside of a container ( The container being the adt
that stores all of these things collectively ). Of course the ADT can
contain other abstract data types and they can talk to each other by
passing messages to one another. And yes you can do this in Pascal as
well =)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top