Abstract Data Types: Definition & Example

Instructor: Martin Gibbs

Martin has 16 years experience in Human Resources Information Systems and has a PhD in Information Technology Management. He is an adjunct professor of computer science and computer programming.

Understanding abstract data types in programming should not be as hard as understanding abstract art. This lesson will cover the concept of abstraction and abstract types and provide some working code examples.


You may not realize it, but abstractions are part of everyday life. Each time you launch a card game on your smart phone, a game loads. Well, mostly loads. You don't need to know all of the processes that occur behind the scenes. If you click Start Double Diamond, you don't need to know how the cards are shuffled or counted. All you need to do is click Start.

phone game

We don't have to know anything about how the game is launched, or what internal programs are run on the phone to make it happen. All we have to do is push a button.

Abstraction as a concept can be best summarized as follows:

We use abstraction when we need to separate the HOW from the WHAT. The WHAT is the Start button on the card game, the HOW is the shuffle of the deck. The HOW is abstract.

Here's yet another way to phrase it. Think of abstraction in terms of a model. A Game is a generic model (abstract) that has some methods. If we think at a higher level, the Game and its operations are abstract concepts. We don't need to know how it works, we can simply invoke the shuffleCards() method.

Now that we've covered abstraction as a concept, let's look at abstract data types and how they fit into programming.

Abstract Data Type

Since we have a little better grasp on abstraction, we can extend that to the abstract data type. If you've guessed that an abstract data type is one that we keep in the HOW part of our code, you've guessed correctly.

Abstract Data Type: Still a Concept

Although we will show specific examples, there's still a little more conceptualizing going on with them. An abstract data type is really a combination of objects and the operations behind the scenes.

The following diagram describes this concept. A user is running a program. The implementation is hidden behind a layer of abstraction. Since the user doesn't need to know all the details, we can affectionately call this layer the abstraction layer.

abstract data type abstraction layer


Let's take a look at some examples in Java and C++. These will help underscore the concept.


In order to make this concept a little easier to understand, we've named our classes in Java as abstract (using the abstract keyword). However, to Java, an abstract data type really the combination of a class and its methods.

The following code example declares a class for Game and a class for CardGame. CardGame is the class that does the lifting. In this example, there's nothing really to the Game class. Another example in Java is the List class. There's no real List class, but ArrayList and LinkedList are classes underneath it.

Java abstract data type

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account