Data Abstraction & Encapsulation in OOPLs

Instructor: David Gloag
In this lesson, we'll take a look at the OOPL, what it is, what abstraction is, what encapsulation is, and how all of these ideas are combined to create something greater.

The Mission of Programmers

Programmers are an inherently lazy bunch. If you don't believe this is true, just watch a few. They are constantly looking for easier ways to do things. Years ago, they started off writing programs in machine code, but quickly discovered that it took time. They moved to assembly language which was faster, but that still took a fair bit of time. They then moved to high-level languages, languages that provide powerful commands that did more with less code. But that forced them to work in non-intuitive, procedural ways. These days, programmers are looking for something unique, something that would provide the power of a high-level language, but would mimic the real-world. One of the ways is an OOPL.

What is an OOPL?

OOPL is an acronym that stands for Object Oriented Programming Language. It is a computer language that treats entities in the system like we would treat the things around us, like objects. To a computer language, an object is a collection of information, and the operations that can be performed on that information. Let's look at a simple example. Say that in real-life we have a pencil. With that pencil we can write things, draw things, and erase things. In a computer, that pencil might be represented by the following:

  • Object Name - data, the name of the object in question, in this case 'pencil'.
  • Drawing Color - data, the color that the pencil draws with, in this case 'black'.
  • Write - operation, the act of writing some words on a page.
  • Draw - operation, the act of creating an image on a page.
  • Erase - operation, the act of removing pencil marks from a page.

Object oriented programming languages provide the construction mechanism to implement the descriptions given above, and to group them together.

What is Abstraction?

In computer programming, abstraction is a simplification process. The idea is hide all of the gory details in the inner workings, and only allow a simple interface to be presented to the user. As an example, consider your vehicle. For most, there are literally thousands of parts that contribute to its operation. But do you need to know about them all to drive? Certainly not. In fact, most of what you need is displayed on the dashboard. The dashboard is an abstraction. The controls and gauges give you access to everything the vehicle can do without burdening you with the details of how each part contributes.

What is Encapsulation?

In computer programming, encapsulation is a grouping process. The idea is to collect everything necessary to work with or describe an entity, and provide it as a self-contained unit. When you talk about the unit as a whole, you refer to it by some type of label. But it is understood that all the parts that make it up go along with the label. As an example, consider again the vehicle from the previous section. When we think of a vehicle, we know without seeing that it has wheels, it likely has doors, it runs on some sort of fuel, and it will have a windshield(s). We know all of this because the term 'vehicle' (an abstraction) gives us basic information through encapsulation (a vehicle generally has wheels, doors, runs on fuel, etc.).

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