7.1 Intro Abstraction

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »

4 hours 19 minutes
Video Transcription
Hi and welcome back to the course.
I hope you guys are doing well. And if you remember in the last video Lecter, we went over at the concept of encapsulation. And in module seven, we're going to be discussing the second component of old P or object oriented programming called Abstraction.
Now, as always, I've listed out some learning objectives for you to follow throughout this via lecture.
The first point that we're gonna be going over is understanding the basic high level idea of abstraction and what it is about.
Then we're gonna move on to discussing how we could use this concept of abstraction in a real world program and why we would use it.
Finally, we're going to be discussing some of the differences between abstraction and and encapsulation, since that tends to be a topic of confusion between programmers and just regular human beings.
All right, so what is abstraction about?
So if we begin with the formal definition, abstraction is a process of hiding implementation details from the user. You essentially don't want to tell the user, and you're not trying to tell the user how you're implementing all the things in or the implementation details of your program.
Now the only thing provided to the user is functionality. An example of this could be when we go to withdraw money or deposit money into our bank accounts, we don't have to deal with the background process of how all of that is actually done. We simply punch in a four digit pin code,
and we sent her inside our car to select what operation we would like to perform.
And boom, it does it for us. So that would be a perfect example of keeping things abstract and abstraction.
Now this abstraction is achieved through two methods. So one is abstract classes. And then there's interfaces, and these absolute classes could also include something called abstract methods.
All right, so I'm gonna show you some of the rules that
ah, you need in order to create or maintain an abstract class or rules around absolute classes in general.
So first, after classes may or may not contain abstract methods.
Now, if this does not work both ways, so let's say you have an abstract method,
then that means your class has to be abstract. But just because your classes abstract doesn't mean you need to have abstract methods. We will understand this in more depth once we move on to our lab. But the second point here is if a class has at least one abstract method in the class itself must be declared as an absolute class, which is
just what I mentioned
after the first point.
Now, if a class is declared abstract, that means it cannot be in Stan. She hated. So you cannot create copies of that class like that.
OB start classes have to be inherited in order to be used,
And the last point is that
if an actor class is inherited than implementations for all, the abstract methods must be provided in the child class. That in hurts that specific abstract class.
All right, so let's discuss some of the differences between
obstruction and encapsulation,
so abstraction solves the problem in the design level. Over, as encapsulation solves a problem in the implementation level,
obstruction deals with hiding the data and unwanted data and giving out relevant data and encapsulation means hiding the code and putting all the data into a single unit
abstraction. Let's you focus on what the object does instead of how it actually performs that certain operation,
whereas in calculation means hiding the internal details. All the mechanics of how an object does something.
Finally, abstraction is tthe e out earlier. So it's, um it's basically the design. So for an example that was rented here, is that it's ah, the outer look of a mobile phone like it has a display screen and key pad buttons to dial a number.
So again, back to the bank account example, it just shows you the outside picture of what? What you're seeing, what you're gonna be using. But it doesn't really tell you the implementation behind it and how these things and processes work,
whereas encapsulation is the in early out and that is what is used for implementation.
So an example is interim implementation detail of a mobile phone. How keep had button and displace kings are connected with each other using circuits, so that then would be an example of encapsulation which is hiding, um, the
All right, so if we summarize our video, we went over the high level idea of
abstraction, Then we discussed it's used in real world programs. So just to reiterate over that second bullet point if you were trying to hide Thean Plantation details of something from a user, that is where abstraction would come in. And a lot of the times you do do that, for example, with bank accounts like I mentioned,
you do not want to
tell the user how you're processing this money, how you're withdrawing money out. You just want them to use the functionality part of it. There is no need for them to know how it is implemented.
And finally we discussed the differences between abstraction and encapsulation.
All right, so coming up next, we're going to be starting our lab for this'll model on abstraction. And that lab is a fairly bigger lab in comparison to the other ones. And we'll be seeing how we can implement this concept
now is always thank you very much for watching my video. And if you have any questions at all, feel free to contact me via Lincoln, and I would be more than happy to answer any of your questions, and I look forward to seeing you in the lab that's coming up
Up Next