Mustard-encapsulation (conversion)

Source: Internet
Author: User
Mustard
---- Encapsulation
Author: HolyFire
Starting with object-oriented OOP, many people shouted encapsulation.
What is encapsulation? Why?
Yes, there is no encapsulation. Encapsulation is generated because of people's needs, just as computers come to the world, and programming languages enter your brain, naturally.
When there is no encapsulation, people are programming, and the appearance of encapsulation does not make the ape monkey human, so encapsulation is not so mysterious and terrible.
Imagine that there are also a lot of encapsulation in our life: food is put in a bag to prevent dust and insect erosion; wearing sunglasses to prevent ultraviolet rays from harming your eyes; money and valuables are put in the safe to prevent people with bad intentions.
Well, we can see that one function of encapsulation is to protect our things.
There are a lot of practices in life. If we want to mention one thing here, it will always be a true expression. This is an ideal situation, however, people often like to create such a thing, just like "water is flowing down ". Newton said, "because of the gravity of the Earth, Apple fell to the ground." Thanks to this, we only have water to drink and Apple to eat. Of course, it is difficult to find counterexamples on the Earth, so we don't need to consider the possibility of Apple flying onto the sky. Another example is that the human hearing range is 2 kHz ~~ 20 kHZ. If someone says there is a person on the Earth who is beyond this range of hearing, I have no objection at all, but I still regard human hearing as 2 kHZ ~~ 20 kHz to deal with, should be a probability theory, small probability will not happen, I do not intend to confirm him, I just want to use him, I only deal with 2 kHz ~~ The 20 kHz auditory range is sufficient in most fields, so that people with special requirements may struggle to deal with these individual cases.
We can also find that the benefits of encapsulation can reduce complexity.
I think no one will be stupid enough to add a goat and a cow to get the results of two sheep or two cows, but the results of the two animals are acceptable.
In this way, encapsulation can reduce the possibility of errors.
Encapsulation is far from doing this.
Wait, are you confused.
After talking about it for so long, why don't we explain what the encapsulation is? It is not mentioned in this article.
Smart Friends, encapsulation is not anything, nor a method. They are people's ideas for thinking about and solving problems. They are your thoughts and your inspiration, it's your best bet. Encapsulation is a solution for people to better manage and use things. It makes you more convenient and safer to do what you want to do. For a long time, smart geeks have found some solutions to the problem by using encapsulation.
In programming applications, let's look at the benefits of encapsulation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.