Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So, there are four fundamental ideas in Object-Oriented Programming, four things to keep in mind when creating classes, and they have the wonderful terms Abstraction, Polymorphism, Inheritance, and Encapsulation. And one way to remember these is with the acronym APIE. Now, these terms can sound intimidating, but you do most of them already in daily thought and conversation even if you don't use these actual words. Let me prove that with the first one, Abstraction.
If I say table, you know what I mean. I didn't say if I was thinking of a wooden table or a glass-topped table, if it had four legs or one central pillar, if it was large or if it was small. You might have an image in mind, that's okay. But I don't have to get that specific because you understand the idea of a table, the abstraction of a table. You've seen and experienced enough real tables to abstract the idea of what a table means.
Abstraction means we focus on the essential qualities of something rather than one specific example. An abstraction means that we automatically will discard what's unimportant or irrelevant. So your mental model of a table might have a potential height and width, but it's unlikely to have an engine size or flavor because those things are irrelevant to the idea of a table. So, abstraction means that we can have an idea or a concept that is completely separate from any specific instance.
It's what we do all the time in conversation, and it's at the heart of Object-Oriented Programming because it's what we're doing when we make a class. Abstraction means that we don't create one class for Joe's bank account and a separate class for Alice's bank account. We will focus on the essential qualities of the idea, and we will write one bank account class. We will focus on things like each of these will have an account number, each of these will have a balance.
And because we always want to discard what's unimportant, it's never just what does a bank account class look like? It's what should a bank account class look like for this application under these circumstances at this time, focusing always just on the essentials. So it might be true that every bank account was opened on a specific date, but if our application doesn't care about that piece of information, we don't need that attribute defined in our class.
But as we'll see, it's abstraction that is the foundation that supports other fundamentals of Object Orientation, such as Inheritance and Polymorphism.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 105272 Viewers
56 Video lessons · 117035 Viewers
71 Video lessons · 86229 Viewers
131 Video lessons · 41222 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.