7.1 Intro Abstraction
Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or
Already have an account? Sign In »

Video Transcription
00:00
Hi and welcome back to the course.
00:03
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.
00:19
Now, as always, I've listed out some learning objectives for you to follow throughout this via lecture.
00:24
The first point that we're gonna be going over is understanding the basic high level idea of abstraction and what it is about.
00:33
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.
00:43
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.
00:59
All right, so what is abstraction about?
01:03
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.
01:21
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,
01:41
and we sent her inside our car to select what operation we would like to perform.
01:45
And boom, it does it for us. So that would be a perfect example of keeping things abstract and abstraction.
01:52
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.
02:06
All right, so I'm gonna show you some of the rules that
02:10
ah, you need in order to create or maintain an abstract class or rules around absolute classes in general.
02:20
So first, after classes may or may not contain abstract methods.
02:27
Now, if this does not work both ways, so let's say you have an abstract method,
02:34
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
02:53
just what I mentioned
02:53
after the first point.
02:58
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.
03:07
OB start classes have to be inherited in order to be used,
03:13
And the last point is that
03:14
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.
03:27
All right, so let's discuss some of the differences between
03:30
obstruction and encapsulation,
03:32
so abstraction solves the problem in the design level. Over, as encapsulation solves a problem in the implementation level,
03:39
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
03:53
abstraction. Let's you focus on what the object does instead of how it actually performs that certain operation,
04:00
whereas in calculation means hiding the internal details. All the mechanics of how an object does something.
04:09
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.
04:25
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,
04:40
whereas encapsulation is the in early out and that is what is used for implementation.
04:47
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
05:04
data.
05:05
All right, so if we summarize our video, we went over the high level idea of
05:12
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,
05:31
you do not want to
05:33
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.
05:45
And finally we discussed the differences between abstraction and encapsulation.
05:50
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
06:05
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
Similar Content